htaccess的给予500 - 内部服务器错误错误、服务器、htaccess

2023-09-02 20:33:00 作者:我已伤痕累累

我保护与htaccess以及htpasswd的HTML文件。当我尝试访问它,把两个用户名和密码,而不是装载的index.html文件,我得到经过500 - 内部服务器错误

I am protecting a html file with htaccess and htpasswd. When I try accessing it, after putting both user and password, instead of loading the "index.html" file I get a "500 - Internal Server Error"

AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile home/folder/index.html/.htpasswd 
AuthGroupFile /dev/null 
require valid-user

有什么建议? 也许一些与托管服务?

Any suggestions? Maybe something with the hosting service?

推荐答案

首先,请查阅错误日志(通常位于 /var/log/apache2/error.log )查看错误的确切原因。

First of all, consult the error-log (usually located in /var/log/apache2/error.log) to see the exact cause of the error.

如果你没有访问它,检查以下内容:

If you do not have access to it, check the following:

是该技术由服务器支持? (请询问您的提供商或管理员) 是的AuthUserFile 是否正确?这似乎是缺少一个斜杠和目录是不寻常的。我会怀疑像的AuthUserFile /home/webuser/sitefolder/.htpasswd 。 组文件更改为目录AuthGroupFile无,而不是指向阿帕奇读的/ dev / null的。想想的/ dev / null的作为底少垃圾桶。这是不容易从那里得到任何东西,可能是一个原因服务器出现故障尝试。 更改您的要求为需要有效的用户而言。它需要一个资本R上。 is this technique supported by the server? (ask your provider or admin) is AuthUserFile correct? It seems to be missing a slash and the directory is unusual. I would have suspected something like AuthUserFile /home/webuser/sitefolder/.htpasswd. change the group-file to AuthGroupFile None instead of pointing apache to read /dev/null. Think of /dev/null as a bottom-less trashcan. It's not easy to get anything from there and might be a reason for the server to fail trying. change the case of your require to Require valid-user. It needs to be a capital R.

要总结:

AuthName "Restricted Area" 
AuthType Basic 
AuthUserFile /home/webuser/sitefolder/.htpasswd 
AuthGroupFile None
Require valid-user

有关进一步信息,我建议 http://httpd.apache.org/docs/ 。

For further info, I recommend http://httpd.apache.org/docs/.