Set AllowOverride all on Apache Servers
June 6, 2020
Ubuntu Server
In case you are on Ubuntu, edit the file /etc/apache2/apache2.conf
(here we have an example of /var/www
):
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
and change it to;
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
then,
sudo service apache2 restart
You may need to also do sudo a2enmod rewrite
to enable module rewrite.
Centos 7,8 Server
If you have Centos server, edit the file /etc/httpd/conf/httpd.conf
And depending on what directory level you want to relax access to, you have to change the directive
AllowOverride None
to
AllowOverride All
So, assuming you want to allow access to files on the /var/www/html directory, you should change the following lines from:
<Directory "/var/www/html">
AllowOverride None
</Directory>
to
<Directory "/var/www/html">
AllowOverride All
</Directory>
You may need to also do sudo httpd rewrite
to restart the Apache.
How to check if .htaccess is loading:
Make sure .htaccess is working with Allowoverride All – Hide My WP Ghost
You can find more situations here: https://stackoverflow.com/questions/18740419/how-to-set-allowoverride-all