WordPress Permalinks on Ubuntu Apache Server

I have encountered this interesting issue with WordPress permalinks when I was installing WordPress locally. Everything was fine until I changed WordPress Permalinks Settings to Post Name. The .htaccess file was created, it had correct permissions, but the page still didn’t load!

Thanks to VC I found the solution for my specific case. All I had to do was to change configuration on the Apache server.


In console open the file /etc/apache2/sites-available/000-default.conf:

sudo nano /etc/apache2/sites-available/000-default.conf

Under DocumentRoot /var/www/html place the following code that will enable overrides. You may need to change the link!

<Directory /var/www/html>
    AllowOverride All

Then enable apache module rewrite.

sudo a2enmod rewrite

And restart the server.

sudo service apache2 restart

Yay, now pages load with post name permalinks!