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'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

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

If you look at the Directory directive within the docs:

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.

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

share|improve this answer

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.