Forum Topic: 500 error when password protecting a directory
When I copy the code the following code from the book into a blank .htaccess file, I get a 500 error:
<IfModule mod_authn_file.c>
AuthName "Username and password required"
AuthType Basic
AuthUserFile /my/own/path/.htpasswd
<Limit GET POST>
Require valid-user
</Limit>
</IfModule>
If I just use the following code, it’s working:
AuthType basic
AuthName "Username and password required"
AuthUserFile /my/own/path/.password
Require valid-user
What is the difference?
3 Replies to “500 error when password protecting a directory”
Hi Jan,
It looks like maybe a required module is not install/active.. are you able to locate the associated error message in your server log(s)? That would help us pinpoint the exact issue.
Hey Jeff,
unfortunately I don’t have access to the server logs, the web host won’t give them to me.
It’s a client site that I had to protect.
However, since the code without
<IfModule mod_authn_file.c>
...
</IfModule>
is working fine, I assume that will do the job as well.
Thanks for your fast reply!
Alright that works! Best of luck with your project :)