我正在尝试用密码保护一个目录,并且目录中有两个文件应该用密码保护它:
访问:
###Contents of .htaccess:
AuthUserFile /var/www/html/path/to/my/directory/.htpasswd
AuthName "Protected Files"
AuthType Basic
Require user admin
HTPASSWD:
###Contents of .htpasswd
admin:oxRHPuqwKiANY
密码也是admin,但是不管我用什么密码,总是出错。它立即再次要求输入密码!
这个配置有什么问题?
最佳答案
这个问题几乎总是因为 apache 无法读取 .htpasswd 文件。想到的原因有四个:
ls -l/var/www/html/path/to/my/directory/.htpasswd
您可能会在 Apache 错误日志中找到有用的消息。
我的钱在#3。
关于.htaccess - htaccess 不起作用 - 总是错误的密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10015081/