Apache redirects directories
- by Ziaix
So, I'm trying to redirect any pages to a file, but avoid redirecting anything thats an existing file or directory.
RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
RewriteRule ^(.+)$ $1 [L]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteRule ^(.+)$ /index.php?page=$1 [QSA]
However, any directories still get redirected (existing files are fine and can be located.)