If your freshly installed WordPress site is throwing standard 404 errors (the Apache default look and feel 404 pages mind you) instead of showing your content when accessing via permalinks, then chances are pretty pretty high that either a) WordPress can’t write to your .htaccess file or b) the Apache rewrite (mod_rewrite) module isn’t installed.

To solve this you’ll need to have SSH access into your Ubuntu server. Once you have logged in, head over to your WordPress install directory and see if there is a .htaccess file there:

ls -a .htaccess

If it isn’t there then that means that WordPress was unable to automatically create it, probably because of file rights. To resolve this, create a .htaccess file:

 touch .htaccess

And populate it with the following WordPress default .htaccess content:

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

Next, give it appropriate file rights:

chmod 755 .htaccess

Finally, let us go make sure that the Apache mod_rewrite module is installed by running the following:

sudo a2enmod rewrite
sudo service apache2 restart

With the mod_rewrite now enabled under Apache, next is to ensure that the AllowOverride directive is set appropriately for your Apache vhost directory declaration – you can use either AllowOverride FileInfo or AllowOverride All to achieve this. For example, for the default website, edit /etc/apache2/sites-available/default to reflect:

<Directory /var/www/>
            Options Indexes FollowSymLinks MultiViews
            # changed from None to FileInfo
            AllowOverride FileInfo
            Order allow,deny
            allow from all

With both of these now in place, your permalink problem should be solved.

horizontal wordpress logo landscape