WordPress Permalinks on Ubuntu

May 29, 2017 - Linux, WordPress

I have encountered this interesting issue with permalinks when I was installing WordPress locally. Everything was fine until I changed 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 and the solution 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!