Apache Web Server .htaccess File Configuration Not working

by on March 19, 2008 · 17 comments· LAST UPDATED August 23, 2012

in , ,

I'm using a CentOS Linux server with Apache 2 web-server and PHP. I've created .htaccess file for URL rewrting and other configuration options. However, my Apache version 2 .htaccess configuration is not working at all. How do I fix this problem?

.htaccess is Apache's directory-level configuration file. It allows end user to configure authentication and other options without editing main httpd.conf file.

Make sure AccessFileName set to .htaccess

Search httpd.conf for AccessFileName directive. It defines name of the distributed configuration file:
# grep -i AccessFileName httpd.conf

Make sure users are allowed to use .htaccess file

What you can put in these files is determined by the AllowOverride directive. This directive specifies, in categories, what directives will be honored if they are found in a .htaccess file. If this directive is set to None, then .htaccess files are completely ignored. In this case, the server will not even attempt to read .htaccess files in the filesystem.
# grep -i AllowOverride httpd.conf
When this directive is set to All, then any directive which has the .htaccess Context is allowed in .htaccess files:
AllowOverride ALL
Save and close the file. Restart httpd:
# service httpd restart

See also:
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 17 comments… read them below or add one }

1 webdesign June 18, 2008 at 12:54 pm

Well i tried that with apache2 but i only found a AllowOverride None wich is uncommented! and httpd.con seems te be apache2.conf … maybe a little help would be nice :)

Reply

2 webdesign etten-leur November 25, 2008 at 3:12 pm

Great tutorial. We use Apache too. thanks

Reply

3 Marcos February 10, 2010 at 6:06 pm

Really thanks buddy. Save my day.

Reply

4 jsherk June 27, 2010 at 8:36 pm

Thanks for this…
AllowOveride was set to None. changed it to All and now my htaccess files work!

Reply

5 anon November 5, 2010 at 12:54 pm

If it doesn’t work search for more than one occurance of AllowOverride. Drove me mad! Thanx :D

Reply

6 Chris January 15, 2011 at 5:24 pm

This just helped me fix my server. Thanks!

Reply

7 selvakumar July 13, 2011 at 6:51 am

The htaccess file in ftp where we have to upload( which directory)
please help me any one.

Reply

8 ganesh August 31, 2011 at 4:52 pm

Thanks

Reply

9 Edy September 9, 2011 at 9:51 am

Great! Just what I was looking for. Thanks.

Reply

10 Hethrir November 11, 2011 at 10:39 pm

Spelling error:

Q. .htaccess is Apache’s directory-level configuration file. It allows end user to congigure authentication and other options without editing main httpd.conf file.

“congigure”

Reply

11 Chaim January 19, 2012 at 2:19 pm

Excellent, just what I needed. Thanks!

Reply

12 Kirby February 9, 2012 at 1:35 am

Thanks. Short and Sweet.

Reply

13 Rao vat March 17, 2012 at 3:49 am

Thanks for this..
cyberciti like

Reply

14 Peter March 21, 2012 at 6:53 am

I changed from one server to another and when i upload the .htacess file, i can’t bowse the webiste. When I remove the .htacess file, I can access the site but not the idex file or fomrs. Anyone who can assist me resolve this problem. Thank you.

Reply

15 John Styl April 19, 2013 at 12:26 pm

AllowOverride ALL That worked for me!
Thank you for solving my problem

Reply

16 sorab April 25, 2013 at 12:47 pm

Hi, I have a joomla website under construction and I have uploaded it , but it does not work, my problem is that the .htaccess is not showing error so I can understand the source of the failure. does anyone know why?

Reply

17 Stretch August 6, 2013 at 2:36 pm

Saved my butt in the early hours of the morning. Thank you so much.

Reply

Leave a Comment

Tagged as: , , , , , , , ,

Previous Faq:

Next Faq: