问题描述
我已将一些代码(用于 Wordpress 永久链接)复制到根目录中的 .htaccess 文件中.一切都很好.这是代码:
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>
我现在创建了一个新目录,我想使用 .htaccess 对其进行密码保护.我已经设置好了(在我想保护的目录中使用了一个 ht.access 文件),但是当我尝试浏览到受密码保护的目录时,我被重定向到主要站点 index.php 页面.
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.
我猜我需要在根目录中的 .htaccess 文件中添加一些东西?这是正确的,如果是的话,有人可以告诉我我需要添加的代码吗?
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?
推荐答案
将其放入受密码保护的 subdir .htaccess 文件.
Put this to your password protected subdir .htaccess file.
<IfModule mod_rewrite.c>
#Disable rewriting
RewriteEngine Off
</IfModule>
这篇关于在目录中停止 .htaccess mod_rewrite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!