Question
Homepage Works but Pages/Posts shows 404 error (apache)
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:
- Change permalinks to default and then back again to your target URL pattern - Didn’t work.
- 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
- 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.
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.
×
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/.
You should also check for ssl conf of your host file.
In my case, i had to add the following block to my virtual host.
In my case I had to add the code in apache2.conf file as well