我有以下mod_rewrite规则:
RewriteRule ^stats/$ stats/index.php
RewriteRule ^adm/$ adm/index.php
RewriteRule ^iphone/$ iphone/index.php
RewriteRule ^android/$ android/index.php
RewriteRule ^([^/\.]+)/?$ index.php?page=$1
RewriteRule ^([^/\.]+)/([0-9]+)/$ index.php?page=$1&pn=$2
RewriteRule ^categories/([^/\.]+)/([0-9]+)/$ index.php?cat_name=$1&pn=$2
RewriteRule ^([^/\.]+)/([^/\.]+)/$ index.php?app_name=$2
RewriteRule ^([^/\.]+)/([a-zA-Z]+)-([^/\.]+)/$ index.php?app_name=$2-$3
RewriteRule ^news/([^/\.]+).(html|htm)$ index.php?news_url=$1
但是,当我添加以下行时:
RewriteRule ^faq/([^/\.]+)/?$ index.php?page=$1 [L]
它打破了,我认为这是因为规则5之间存在冲突,所以我在此之前添加了它,但仍然 - 没有......任何人都可以阐明如何在我的htaccess中加入这个规则吗?
编辑: 查看错误日志时(需要一段时间,因为必须设置一个子域来不伤害主站点):
[Thu Sep 22 01:04:06 2011] [alert] [client 212.199.198.140] /home/my71/*/.htaccess: RewriteRule: bad flag delimiters
编辑2:无法访问我的htpdconfig,但是htaccess:
#WWW TO NON WWW
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteCond %{REQUEST_URI} [A-Z]
RewriteMap lc int:tolower
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteRule (.*) ${lc:$1} [R=301,L]
#URL REWRITES
RewriteRule ^stats/$ stats/index.php
RewriteRule ^adm/$ adm/index.php
RewriteRule ^iphone/$ iphone/index.php
RewriteRule ^android/$ android/index.php
RewriteRule ^([^/\.]+)/+$ index.php?page=$1
RewriteRule ^([^/\.]+)/([0-9]+)/$ index.php?page=$1&pn=$2
RewriteRule ^categories/([^/\.]+)/([0-9]+)/$ index.php?cat_name=$1&pn=$2
RewriteRule ^(?!.*faq)([^\/.]+)\/([^\/.]+)\/$ index.php?app_name=$2
RewriteRule ^news/([^/\.]+).(html)$ index.php?news_url=$1
# compress text, html, javascript, css, xml:
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
# Or, compress certain file types by extension:
<Files *.html>
SetOutputFilter DEFLATE
</Files>
谢谢,Itai