_7788 发表于 2006-4-26 12:03:38

如何应用mod_rewrite

用过一些开源CMS和论坛
每个软件除了编辑好.htaccess文件外,还要在在相关设置打开SEF开关
请问“打开sef开关”设置做哪些事情?

另外: 我自己配好apache 和 .htaccess 文件后,网站将会不可访问

涩兔子 发表于 2006-4-26 16:13:43

可以借鉴drupal的rewrite规则:

# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on

# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
#RewriteBase /drupal

# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]

# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]

# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>


then http://drupal.org/search/node/CleanURL
页: [1]
查看完整版本: 如何应用mod_rewrite