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?
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
correct? It seems to be missing a slash and the directory is unusual. I would have suspected something like AuthUserFile /home/webuser/sitefolder/.htpasswd
.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.Require valid-user
. It needs to be a capital R.To sum up:
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /home/webuser/sitefolder/.htpasswd
AuthGroupFile None
Require valid-user
For further info, I recommend http://httpd.apache.org/docs/.