Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers

up vote 1 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
add comment

your shall use AuthUserFile since AuthDigestFile is deprecated since apache 2.2

See http://wiki.apache.org/httpd/InvalidCommandAuthDigestFile

share|improve this answer
add comment

I have no specific reason for using it but I was following the apache guide which included the tags: http://httpd.apache.org/docs/2.0/mod/mod%5Fauth%5Fdigest.html

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
add comment

Your Answer

 
discard

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.