RewriteRule Last flag being ignored
I don't get that if a rewrite rule matches and it has the Last [L] flag that it still executes the rules beneath. I redirect all calls to the public folder but I've added an exception for images, but the exception is being ignored. I thought that with the [L] flag if a rule matches it stops looking for rules beneath.
This is my .htaccess file:
Rew开发者_运维问答riteRule ^image/(.*)/?$ image.php?t=$1 [L]
RewriteRule ^$ public/ [L]
RewriteRule (.*) public/$1 [L]
If I remove the bottom 2 rules it does work.
Thanks in advance
It is not ignored. It is the specific of .htaccess. It reruns every time URL is changed.
Try this instead.
RewriteEngine on
RewriteCond %{QUERY_STRING} rewritten
RewriteRule .* - [L]
RewriteRule ^image/(.*)/?$ image.php?t=$1&rewritten=1 [L,QSA]
RewriteRule ^$ public/?rewritten=1 [L,QSA]
RewriteRule (.*) public/$1?rewritten=1 [L,QSA]
精彩评论