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'm on a shell, and my web folder is located at /home/w/waterfox/public_html. In there, I have a directory called irclogs, which I'm trying to password-protect. It is chmodded to 755.

Here is the .htaccess file that I placed in my public_html folder:

<Directory /home/w/waterfox/public_html/irclogs>
AuthUserFile "/home/w/waterfox/public_html/.htpasswd"
AuthType Basic
AuthName "Restricted"
Require valid-user
</Directory>

When I try to access any part of my website, including stuff outside the irclogs folder, I get a 500 Internal Server Error.

It doesn't seem to have anything to do with my .htpasswd file, because I can protect individual files with <Files> or <FilesMatch> just fine.

share|improve this question
add comment

2 Answers

up vote 6 down vote accepted

<Directory> tags are not needed in .htaccess files, as it's assumed you want the included rules to be applied to folder in which the .htaccess resides. Take out the opening and closing <Directory> tags, move the .htaccess into your irclogs folder, and you should be good.

share|improve this answer
add comment

If you look at the Directory directive within the docs:

http://httpd.apache.org/docs/current/mod/core.html#directory

You'll see there's a Context description within the description box:

This indicates where in the server's configuration files the directive is legal.

http://httpd.apache.org/docs/current/mod/directive-dict.html#Context

As you can see, .htaccess is not present in that list for the reason ErikA pointed out.

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.