By ankushdas9
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:
<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.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
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
Hello,
Just came across this question and wanted to mention one more thing to what has already been said. You would also need to make sure that you have Mod Rewrite enabled in order for the .htaccess
rules to work:
sudo a2enmod rewrite
After enabling the module, run an Apache config test:
sudo apache2ctl -t
And if you get Syntax OK
then make sure to restart Apache:
sudo systemctl restart apache2
Regards, Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.