I want to use a php script to handle URL errors. So I read
http://p2p.wrox.com/moderated-pro-php/29820-database-driven-clean-urls-apache-mod_rewrite.html
which recommends the following:
# If the REQUEST_FILENAME does not exist as a file or directory
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d
RewriteRule ^(.*) /index.php?%{QUERY_STRING} [L]
(to make it work, I had to remove the “/” in the last line)
It fails bizarrely. It rewrites most names, even those of actual files. But not all. The name http://physpics.com/images/BlueNext.png is NOT rewritten, but the name …/BlueGNext.png is rewritten. The two files have identical read permissions.
My question: Why is this rule altering the names of actual existing files??? Why is the !-f ignored?