Apache is Ignoring the .htaccess file

KB ID 0000890

Problem

The .htaccess file is a file that lives in a directory on a web server. Its job is to provide ‘settings’ that would normally be set in the servers httpd.conf file. You can put a .htaccess file in any directory to control the settings for that directory, (providing .htaccess override has been allowed).

After having some problems the other day, I made a change to mine, then reliased the change was not applying.

Solution

1. Connect to the server via SSH, (or open a terminal session). Logon as, (or su to) root.

2. Change to the directory that the httpd.conf file is in, (usually the /etc/httpd/conf/httpd.conf directory).

[box] cd /etc/httpd/conf/httpd.conf [/box]

3. First let’s check that the config, has been set to recognise .htaccess as the AccessFileName.

[box] grep -i AccessFileName httpd.conf [/box]

4. Then the server needs to actually allow the overide (this was my problem). The following will show you all instances of AllowOverride, make sure you check them all.

[box] grep -i AllowOverride httpd.conf [/box]

5. To edit the file and change the approriate settings from None to All.

6. Then restart the the web server.

[box] service httpd restart [/box]

 

Related Articles, References, Credits, or External Links

NA