WordPress permalinks not working apache

I recently tried changing my WordPress permalink setting from the default to show the post title. This not only looks more professional but it also enhances readability. When I changed the setting in the WordPress settings page I discovered that the posts would no longer load but instead returned a 404 error as the page was not found.

This was simple to fix. When you change the permalink settings WordPress will modify a .htaccess file within the root directory of the wordpress install. The .htaccess file will look something like:

The most probable reason for the pages not loading is because the Apache configuration is ignoring the .htaccess file. This is simple to change, edit the /etc/apache2/sites-enabled/default.conf and add the following.

The above only affects the directory specified in the opening Directory code, in this case it is the wordpress install. AllowOverride All makes Apache2 take notice of any .htaccess files it finds in the directory, Order allow, deny means all allow directives are evaluated first and the Allow from all means that any IP Address can access the site.

Resources:

Apache2 Docs Allow
Apache2 Docs AllowOverride
How To Use .htaccess File | Digital Ocean Forums

Please share 🙂