Apache is Ignoring the .htaccess file


KB ID 0000890 Dtd 04/12/13


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.


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

cd /etc/httpd/conf/httpd.conf

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

grep -i AccessFileName httpd.conf

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.

grep -i AllowOverride httpd.conf

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

Apache stop .htaccess

Apache allow .htaccess

6. Then restart the the web server.

service httpd restart


Related Articles, References, Credits, or External Links


Author: Migrated

Share This Post On