在目录中停止.htaccess mod_rewrite

时间:2022-04-02 11:22:07

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:

我已将一些代码(对于Wordpress永久链接)复制到根目录中的.htaccess文件中。一切都很好。这是代码:

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

我现在使用.htaccess创建了一个我想用密码保护的新目录。我已经设置了(在我想要保护的目录中使用ht.access文件)但是当我尝试浏览到受密码保护的目录时,我会重新定向到主站点index.php页面。

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?

我猜我需要在根目录中的.htaccess文件中添加一些内容吗?这是正确的,如果是这样,有人可以告诉我我需要添加的代码吗?

1 个解决方案

#1


10  

Put this to your password protected subdir .htaccess file.

把它放到你的密码保护的子目录.htaccess文件中。

<IfModule mod_rewrite.c>

#Disable rewriting
RewriteEngine Off

</IfModule>

#1


10  

Put this to your password protected subdir .htaccess file.

把它放到你的密码保护的子目录.htaccess文件中。

<IfModule mod_rewrite.c>

#Disable rewriting
RewriteEngine Off

</IfModule>