问题
I have copied some code (for Wordpress permalinks) into my .htaccess file in the root directory. All has been working fine. This is the code:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
I've now created a new directory that I want to password protect using .htaccess. I've set that up (using a ht.access file in the directory I want to protect) but when I try to browse to the password protected directory I get re-directed to the main sites index.php page.
I'm guessing I need to add something to the .htaccess file in the root directory? Is this correct and if so could someone tell me the code I need to add?
回答1:
Put this to your password protected subdir .htaccess file.
<IfModule mod_rewrite.c>
#Disable rewriting
RewriteEngine Off
</IfModule>
来源:https://stackoverflow.com/questions/10143068/stop-htaccess-mod-rewrite-in-a-directory