Apache mod_auth_digest doesn’t work

apache-2.2authentication

I've been following the Apache guide to using the mod-auth-digest module but I can't seem to make it function properly. My .htaccess and .htpasswd test files are located in 'localhost/php/private', and the containing code is:

.htaccess:
<Location /private/>
AuthType Digest
AuthName "protected"
AuthDigestDomain /private/ http://localhost/php/private/
AuthDigestFile C:/dev/xampp/htdocs/php/private/.htpasswd
require valid-user
</Location>


.htpasswd:
somedude:protected:e0529e7873a39baca5a9906364258014
#user = somedude, pwd = pwd

The browser keeps returning Error 500. The corresponding apache error log entry says "Location not allowed here", but google doesn't seem to have any useful info on this error.

A basic mod-auth test had worked ok previously, and according to php-info() the mod-auth-digest module is loaded. I can't really figure out whats up, can anyone help?

Best Answer

That is because Location isn't allowed inside the .htaccess context. Any particular reason why you need to specify Location, instead of just putting the .htaccess file in the folder you want to protect?

If you really need to specify Location you will have to do that directly in your Apache configuration.

Related Topic