.htaccess/.htpasswd 500 内部服务器错误 [英] .htaccess/.htpasswd 500 Internal Server Error
问题描述
我正在使用 .htaccess 阻止文件夹,我以前从未使用过,但遇到了一些麻烦.这是我所拥有的
I'm working on blocking a folder with .htaccess, which I've never used before, and I'm having some trouble. Here's what I have
.htaccess(位于我想阻止的文件夹中):
.htaccess (located in the folder I want blocked):
AuthName "Username and password required"
AuthUserFile /.htpasswd
Require valid-user
AuthType Basic
.htpasswd(位于root,密码在实际文件中加密):
.htpasswd (located at root, password is encrypted in actual file):
tim:blah
我收到了 500 个内部服务器错误,我不知道为什么.
I'm getting 500 Internal Server errors with this and I can't figure out why.
推荐答案
最可能的问题是这一行:
Most likely problem is this line:
AuthUserFile /.htpasswd
这一行应该提供密码文件的完整文件系统路径,例如
This line should provide full filesystem path to the password file e.g.
AuthUserFile /var/www/.htpasswd
要发现您的文件系统路径,您可以创建一个包含
To discover your filesystem path, you can create a PHP document containing
echo $_SERVER['DOCUMENT_ROOT'];
这篇关于.htaccess/.htpasswd 500 内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!