除了来自localhost的请求外,我正在尝试对目录进行密码保护。我的.htaccess看起来是这样的:
AuthName "Login"
AuthType Basic
AuthUserFile /PATH/.htpasswd
Require valid-user
Allow from 127.0.0.1
Allow from ::1
Satisfy Any
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
ErrorDocument 404 /index.php
如果删除Allow和Satisfy语句,目录将得到正确的保护。当我添加Allow(一个或两个)和Satisfy Any时,它会生成一个500的错误。日志上写着:
/PATH/.htaccess: allow not allowed here
有线索吗?
如果您有权访问服务器conf文件,请检查:AllowOverride
查看允许的指令。
AllowOverride All
将允许所有指令。
欲了解更多信息,请访问:AllowOverride DirectiveApache Docs