htacess 文件不起作用
我有以下 htaccess,启用了目录列表,但是当转到 .htaccess 文件所在的目录时,没有访问控制。怎么了?
AuthName "Restricted Area" AuthType Basic AuthUserFile /home/xxx/.htpasswd AuthGroupFile /dev/null require valid-user
I have the following htaccess, directory listing is enabled, however when go to the directory the .htaccess file is in, there's no access control. what's wrong?
AuthName "Restricted Area" AuthType Basic AuthUserFile /home/xxx/.htpasswd AuthGroupFile /dev/null require valid-user
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
解决方案是我需要使用
AllowOverride All
来允许目录级别的.htaccess
。The solution is that I need to have
AllowOverride All
to allow.htaccess
at the directory levels.尝试从那里删除
AuthGroupFile
,也许它会造成麻烦。其他一切看起来都完全正确。一种可能是您的 Apache 副本没有为您的文件启用
AuthConfig AllowOverrides
。这将禁用.htaccess
中的Auth*
条目。Try removing
AuthGroupFile
from there, perhaps it is causing trouble.Everything else looks absolutely correct. One possibility is that your copy of Apache doesn't have the
AuthConfig AllowOverrides
enabled for your files. This would disableAuth*
entries in.htaccess
.您必须在顶部输入:
RewriteEngine On
如果这不起作用,则意味着您可能根本没有
RewriteEngine
You must type to the top:
RewriteEngine On
If that does not work, that means you may not have
RewriteEngine
at all