WordPress permalink does not work as per default Apache settings of certain Operating Systems. For example if we need to host WordPress on Apache2 running on Ubuntu server, we need to modify Allow Override rule to make the permalink changes work. In other case WordPress will show a 404 error page if we set up a permalink.

To Allow Override rule in Apache2 and use pretty URLs for WordPress installs on Ubuntu Server or other Operating Systems, a small modification to apache2.conf file is required.

Here is the path of the file and setting that need to be updated to overwrite URL rewrite rule in Ubuntu 16, 17 etc.

Open this file in edit mode: /etc/apache2/apache2.conf

You could use nano editor. The command could go something like this.

cd /etc/apache2/

sudo nano apache2.conf

Then the editor pops the file up.

Look for the following like and make some changes as shown below.

Change AllowOverride None to Allow Override All.

In next step, restart apache and things will be good to go

sudo systemctl restart apache2

Now WordPress Permalink will work. In case if the permalinks still does not work, mod re-write could be enabled using the following command.

And finally restart apache server
sudo systemctl restart apache2