0

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.

Kudu
  • 247
  • 2
  • 4
  • 8

2 Answers2

5

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

EEAA
  • 108,414
  • 18
  • 172
  • 242
1

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.

Rob Olmos
  • 2,220
  • 1
  • 15
  • 25