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.
Chandra Shekhar
Latest posts by Chandra Shekhar (see all)
- Best practices for micro service design - January 23, 2022
- Spring Boot - January 23, 2022
- Java - January 23, 2022
Recent Comments