Apache Web Server .htaccess File Configuration Not working
Q. I'm using CentOS Linux server with Apache 2 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?
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.
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:
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Linux / UNIX FAQ:
- How do I enable apache file and directory indexing under Linux or UNIX?
- Apache redirect domain.com to www.domain.com
- Why my Apache Server Side Include (SSI) is not working?
- LimitRequestBody: Apache Limiting User Upload File Size
- Set Apache Password Protected Directories With .htaccess File
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Please do not use the comment form to ask for help / question. Ask your question on the excellent Linux tech support forum. Thank you very much for stopping by our site!
Tags: .htaccess, apache .htaccess, apache tutorial, apache version, apache2 .htaccess, configuration options, htaccess file, htaccess files, server apache ~ Last updated on: March 19, 2008



Recent Comments
Today ~ 3 Comments
Today ~ 19 Comments
Today ~ 2 Comments
Today ~ 37 Comments
Today ~ 46 Comments