I have some simple RewriteRules that redirect all path variables to /index.php. But now I’m looking to make an exception for all /img/(.*) urls.
Here’s a snippet. Please advise.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1 [L]
I tried adding RewriteRule ^img/(.*) img/index.php/$1 [L] just above the last catchall line but it’s not working.
The result I’m after is something like this:
url --> script / path variables
====================================
/abc/def --> /index.php/abc/def
/img/abc --> /img/index.php/abc
Can you point me in the right direction?
You need to add it not just above the last catchall line, but leave the conditions required by the catchall and likewise duplicate them for your own
/img/routing: