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 have a testing site which has a Require valid-user directive, employing Apache's mod_auth to keep it private, but I'd like to exempt a single file from this requirement (i.e. make it so that you don't need a username / password to access that one file, even though you need a username/password for the rest of the site).

Right now, I have...

AuthUserFile /path/to/htpasswd
AuthType Basic
AuthName "My Private Site"
Require valid-user
<Files filename.txt>
  Allow from All
  Satisfy Any
</Files>

But that doesn't seem to quite be doing the trick (I can see the file, but only after being prompted for a username/password and clicking cancel).

What am I doing wrong?

share|improve this question
    
See. stackoverflow.com/questions/2641646/… for how to hack this. –  Mark Wagner Mar 23 '11 at 21:07
add comment

1 Answer

I think something like this should work:

<FilesMatch "^/path/to/file$"> 
Allow from all 
Satisfy any 
</FilesMatch> 

You could also try the <location> directive instead of the <FilesMatch> directive.

share|improve this answer
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.