我有一个Zend aplication使用hatccess并将所有内容重定向到index.php,但现在我需要在其中一个子文件夹中使用密码保护文件夹,但是当我尝试访问子文件夹时继续给我404错误 .
这里是public_html文件夹中的zend htaccess:
RewriteEngine On
RewriteRule !\.(js|txt|ico|gif|GIF|jpg|JPG|png|PNG|css|swf|pdf|xml|XML|eot|svg|ttf|woff)$ index.php
SetEnv APPLICATION_ENV "production"
这里的子文件夹htaccess:
RewriteEngine off
AuthType Basic
AuthName "*folder*"
AuthUserFile "/home/*user*/.htpasswds/public_html/*folder*/passwd"
require valid-user
我试图将 RewriteRule ^blog/ - [L]
添加到public_html文件夹中,如下所示:Overwrite rewrite-rule of htaccess in parent folder
但它没有用 . 奇怪的是,如果我把子文件夹htaccess的密码部分,“rewriteEngine off”工作,我得到了该文件夹中的文件列表 .
Obs:服务器是apache 2.2.25,所以rewriteOptions InheritBefore不是一个选项
Obs2:文件夹和用户不像实际的htaccess那样只是为了隐藏名称 .
Obs3:我是服务器配置中的菜鸟:)
1 回答
这通常对我有用 . 将代码粘贴到RewriteRule下面的父htacess中