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

i)
<Directory />
Options -Indexes FollowSymLinks
AllowOverride All

</Directory>

ii)

<Directory “/var/www/html”>

Options -Indexes FollowSymLinks
AllowOverride All

</Directory>

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.

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 Conferencing and social media domain. The motive of creating cutehits was just to share the knowledge/solutions I get to know during my day to day life so that if possible I can help someone for same problems/solutions. CuteHits.com is a really a very effort for sharing knowledge to rest of the world. For any query/suggestion about same you can contact me on below details:- Email: shekharmca2005 at gmail.com Phone: +91-9560201363

Latest posts by Chandra Shekhar (see all)

You may also like...