Home Wordpress permalinks not working apache
Post
Cancel

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:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]


# END WordPress

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.

wordpress/install>
              AllowOverride All
             Order allow,deny
             Allow from all

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

This post is licensed under CC BY 4.0 by the author.

If you have found this site useful, please consider buying me a coffee :)

Proud supporter of the Gnome Foundation

Become a Friend of GNOME

Open KDE Menu with the windows/meta key

Setup Raspberry pi as a dhcp server

Comments powered by Disqus.