Reputation: 497
i have this script:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/?(images|orders)/
RewriteRule ^(.*)$ index.php?til=$1 [L,QSA]
it's working fine in my localhost but when i upload it to my hosting and go to www.domain.com/images/
it's redirecting to index.php?til=403.shtml
Upvotes: 0
Views: 85
Reputation: 10888
mod_rewrite repeatedly scans htaccess files until no more substitutions have been made. The [L] flag means "last in this cycle". W.e.f. Apache 2.4 the [End] flag does what you intend. See my Tips for debugging .htaccess rewrite rules for more discussion.
I suspect that the issue is that the dhared host has multiviews enabled and you don't on your dev instance. Always try to align your dev instance as much as possible to the hosting providers. If you don't need it, then always turn multiviews off.
You can always disable this on a per-rule basis by adding the [NS] flag. In this case is you add it to the first rule then you will find that it now works.
Upvotes: 1
Reputation: 497
ok this seemed to work..
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/orders/.* [NC]
RewriteCond %{REQUEST_URI} !^/401.shtml [NC]
RewriteCond %{REQUEST_URI} !^/403.shtml [NC]
RewriteRule ^(.*)$ index.php?til=$1 [L,QSA]
Upvotes: 0