htaccess rules losted when directory exists
this is my code at .HTACCESS file in my web server:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
R开发者_StackOverflowewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
This code works well, but when a directory exists the website redirect to Index of (Apache directory browsing):
For example:
http://www.mywebsite.com/XXXX This redirects to the URL http://www.mywebsite.com/XXXX and the page show information about XXXX. (Directory XXXX doesn't exists)
Directory ZZZZ exists and http://www.mywebsite.com/ZZZZ redirects to Index of (Apache directory browsing)
Finally, the question is how to redirect as 1. example.
RewriteCond %{REQUEST_FILENAME} !-d
This line disables rewriting for existing directories. Simply remove it if you always want to rewrite.
精彩评论