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: https://stackoverflow.com/questions/5182534/wordpress-is-giving-me-404-page-not-found-for-all-pages-except-the-homepage)

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:

<Directory>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

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 domain.com/?123 (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.

1 comment
  • Thank you it helped me. In my case, it was I need to add <Directory /var/www/sitename.com> as I had created a seperate folder instead of default html/ in /var/www/.

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]
</IfModule>
# END WordPress

Thanks. it worked for me.

Submit an Answer