Homepage Works but Pages/Posts shows 404 error (apache)

Posted November 28, 2018 3.5k views
Apache WordPress Ubuntu 18.04

I’ve successfully migrated to Digital Ocean from Cloudways (was utilizing DO as well).

However, except the homepage every other page shows 404 error. (reference:

I’ve looked online and found a couple of solutions:

  1. Change permalinks to default and then back again to your target URL pattern - Didn’t work.
  2. Check your .htaccess file and disable it to see whether that’s what causing the issue - Checked, nothing wrong with that and also WordPress is able to generate a new .htaccess file - so it has the required persmissions
  3. Check your Apache config and ensure that it includes:

Options Indexes FollowSymLinks
AllowOverride All
Require all granted

where AllowOverride should be set to All....

I’ve checked that as well - both vHost file for the domain and the apache2.conf file contains that piece of code.

Am I missing something else? Is there any other way to resolve the error?

Additional Info: When I change my site permalinks to default i.e (the defaul URL structure of WordPress) - it works fine. That means, the site has been restored perfectly.

P.S: Installed WordPress manually for this domain and I have virtual hosts configured in a 1-click WordPress ubuntu 18.04 droplet.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

2 answers

Got a response from the official DO support:

Replaced my original .htacess content (generated by WordPress) with this and it worked.

# 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

Thanks. it worked for me.

Submit an Answer