Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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:

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

#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?

share|improve this question
up vote 2 down vote accepted

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.

share|improve this answer

your shall use AuthUserFile since AuthDigestFile is deprecated since apache 2.2


share|improve this answer
this was my issue, thanks! – EdgeCaseBerg May 21 '15 at 15:04

I have no specific reason for using it but I was following the apache guide which included the tags:

so I removed the location tags, but now I'm getting this error:

"Invalid command 'AuthDigestFile', perhaps misspelled or defined by a module not included in the server configuration"

is this not part of the mod-auth-digest module?

share|improve this answer
Perhaps a stupid question, but are you sure you are running Apache 2.0 and not Apache 2.2? – andol Dec 5 '09 at 13:14
ah you're right! apache 2.2 uses AuthUserFile and not AuthDigestFile. Very confusing =( – Spoonface Dec 5 '09 at 13:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.