Why is Apache ignoring my .htaccess file?

Last updated on | one reply

You will find that .htaccess will be ignored by default in Apache. We can enable it by altering the configuration file.

Firstly, backup the configuration file.

sudo cp /etc/apache2/apache2.conf /etc/apache2/apache2.conf.bak

Open the config file.

sudo nano /etc/apache2/apache2.conf

Scroll down the the following section.

/etc/apache2/apache2.con
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>

AllowOverride None means that .htaccess will be ignored. Change it to AllowOverride All.

/etc/apache2/apache2.con
<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
</Directory>

Save and exit (press CTRL + X, press Y and then press ENTER)

Restart Apache.

sudo systemctl restart apache2

Let me know if this helped. Follow me on Twitter, Facebook and YouTube, or 🍊 buy me a smoothie.

p.s. I increased my AdSense revenue by 200% using AI 🤖. Read my Ezoic review to find out how.

1 reply

Leave a reply

Your email address will not be published.