# .htaccess not working

## phrackattack

I seem to be having a problem getting .htaccess files to work on my server. I've tried a ton of stuff that I know should work, like error documents or basic authentication, and it's as if the file doesn't exist at all. I made sure that AllowOverride All is on, and that AccessFileName is set to .htaccess.

Here's the relevant httpd.conf info:

```

<Directory />

    Options FollowSymLinks

    AllowOverride All

</Directory>

AccessFileName .htaccess

```

----------

## Shazam

does the webserver has read acces to the .htaccess file? and make sure, the webserver owns it to.

----------

## phrackattack

```
nscchelpdesk test # echo ErrorDocument 404 test.html > .htaccess

nscchelpdesk test # echo \<html\>lulz\</html\> > test.html

nscchelpdesk test # cat test.html

<html>lulz</html>

nscchelpdesk test # chown root:apache .htaccess

nscchelpdesk test # chmod 777 .htaccess

nscchelpdesk test # ls -l .htaccess

-rwxrwxrwx 1 root apache 28 Sep 25 14:38 .htaccess

nscchelpdesk test #

```

Still not working.

----------

## Shazam

does ur webserver run with root priviliges? i'd chown it with apache:apache, but the webserver should be able to handle 777.

well, take a look in the logs of apache, what does it say, when you try to access an .htaccess folder? (/var/log/apache/)

----------

## phrackattack

I get a 403.

```
[Tue Sep 25 14:57:59 2007] [error] [client 192.168.207.182] client denied by server configuration: /var/www/localhost/htdocs/test/.htaccess
```

----------

## Hu

Do not set the file to mode 777.  It is not a program, and no one except the owner should be permitted to modify it.  644 would be a much better choice.

----------

## phrackattack

Obviously, I wouldn't use that in a practical setting. I was making sure that access had nothing to do with it, which it does not. Does anyone have any ideas why the .htaccess file isn't being recognized by apache?

----------

## nastasa_andrey

Make sure AllowOverride is set to all in /etc/apache2/vhosts.d/00_default_vhost.conf

----------

## phrackattack

Thanks, that did the trick.

----------

