mod_rewrite: adding a rule causes it to break (error 500)
I have the following mod_rewrite rules:
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
However, when I add the following line:
RewriteRule ^faq/([^/\.]+)/?$ index.php?page=$1 [L]
it breaks, I assumed it's because a conflict between rule 5, so I added it before that, but still - no go... can anyone shed some light on how to incorporate this rule in my htaccess?
Edit: When looking at the error logs (took a while, cause had to set up a subdomain to not hurt the main site):
[Thu Sep 22 01:04:06 2011] [alert] [client 212.199.198.140] /home/my71/*/.htaccess: RewriteRule: bad flag delimiters
Edit 2: don't have access to my htpdconfig, but the 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=3开发者_Go百科01,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>
Thanks, Itai
精彩评论