How to enable .htaccess file on apache server

If you are facing any difficulty about .htaccess file specially you found that .htaccess file is not working for your website then might be it’s a server issue.
In order to check it you need to see your apache configuration file httpd.conf.

See the location of httpd.conf file from by clicking here After opening that file you need to find the directory tag (<directory></directory>).

You can edit httpd.conf file by just typing below command

nano /etc/httpd/conf/httpd.conf

Where /etc/httpd/conf/httpd.conf is the location of httpd.conf file. You can also find the details of nano command by clicking here

When you start looking for tag you may find it on two different location

<Directory />
Options -Indexes FollowSymLinks
AllowOverride All



<Directory “/var/www/html”>

Options -Indexes FollowSymLinks
AllowOverride All


From both of the snippet you must check “AllowOverride All” (Based on requirement). The first one is allows htaccess file on Root level directories only. And second one allows htaccess for a particular directory. And make sure “AllowOverride None” is not written there. If its written then make it “AllowOverride All” and just restart the server after save your current/modified httpd.conf file.

Related posts:

The following two tabs change content below.

Chandra Shekhar

GCP Architect
Chandra Shekhar Pandey is Google certified Cloud engineer, I am Magento2 Trained developer. Having huge experience in designing cloud solution. I have around 12 years of experience with world enterprise IT companies and fortune 500 clients. During my architecture design I am always caring about high availability, fast performance and resilient system. From the programmer background I have huge experience in LAMP stack as well. Throughout my carrier I have worked on Retail, E-Learning, Video... Read More about Chandra Shekhar

Latest posts by Chandra Shekhar (see all)