I need to add an exception for a specific file in my .htaccess. I've tried to add this line:
RewriteRule ^/print.php$ – [L], but it has no effect. Can anybody figure out why?
The whole file looks like this:
RewriteEngine on
RewriteBase /
RewriteRule !^pub - [C]
RewriteRule !^design - [C]
RewriteRule !^bilder - [C]
RewriteRule !^filer - [C]
RewriteRule !^js - [C]
RewriteRule !^pub2010 - [C]
RewriteRule ^/print.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* /index.php [L,QSA]
Best Answer
In a
.htaccess
file, the input to be matched against the pattern doesn't start with a slash.Try this instead:
Incidentally, you can shorten all of those chained rules into just one: