Question
I have a .htaccess file which arranges that all requests go through index.php. Now i would like to make an exception for rss.php. to go straight throuh rss.php. How do I do this?
This is how it looks like now:
RewriteEngine on
RewriteBase /
RewriteRule !\.(js|ico|txt|gif|jpg|png|css)$ index.php
Thanks.
Solution
Put this before the last line.
RewriteCond %{REQUEST_URI} !^/rss\.php$
OTHER TIPS
You can exclude any existing file with an additional RewriteCond
directive:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Or alternatively do a rewrite that matches the file then skips the rest of the rewrite tests.
By putting the following line before your existing RewriteRule will redirect without going through index.php.
RewriteRule ^/rss.php /rss.php [L]
I came across this page while hunting for a way to do this with my /robots.txt file.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow