Apache redirects directories

Posted by Ziaix on Server Fault See other posts from Server Fault or by Ziaix
Published on 2011-01-04T21:09:35Z Indexed on 2011/01/04 21:56 UTC
Read the original article Hit count: 137

Filed under:
|

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.)

© Server Fault or respective owner

Related posts about apache

Related posts about mod-rewrite