Are your WordPress posts returning a 404 error on your website?
This error happens when you can access your WordPress admin area and blog, but when you try to open a post, you will see “404 Not Found”.
In this article, we will show you how to fix the WordPress posts returning 404 error.
What Causes the WordPress Posts Returning 404 Error?
WordPress is a powerful content management system (CMS), but a slight change can sometimes make your WordPress website inaccessible.
In some cases, you may not be able to access your WordPress admin area or the website itself, like with the internal server error or error establishing a database connection.
By contrast, when your WordPress posts are returning 404 errors, you will still be able to get into your admin area and see your WordPress website on the front end. Then, when you click on a blog post, you will see a message saying “404 Not Found”.
Although this error message can be scary, it doesn’t mean you have lost your WordPress posts. Instead, your .htaccess file has probably been deleted, or something went wrong with the rewrite rules on your blog.
That being said, let’s look at how to fix the WordPress posts returning 404 error. You can use the links below to jump straight to different solutions.
Video Tutorial
If you’d prefer written instructions, then just continue reading.
Fix Your Permalink Settings
WordPress posts can return 404 errors because of problems with rewrite rules in your .htaccess file. In most cases, you can fix the problem by updating your permalink settings.
Simply go to Settings » Permalinks in your WordPress admin, and click on the ‘Save Changes’ button.
This will update your permalink settings and flush the rewrite rules.
In most cases, this solution fixes the WordPress posts 404 error. However, if it does not work for you, then you probably need to update your .htaccess file manually.
Update the WordPress .htaccess File
First, you will need to connect to your server using an FTP client or the File Manager app in your WordPress hosting dashboard.
Next, you will need to find and edit the .htaccess file, which is located in the same location as folders like /wp-content/ and /wp-includes/.
Simply right-click on the file and select ‘File permissions’.
You can make the file writeable by changing its permissions to 666.
Simply enter ‘666’ into the ‘Numeric value’ box and then click on ‘OK’.
Then, you need to repeat the steps in the Fix the Permalinks Settings section of our tutorial. Once you have done this, don’t forget to change the permissions back to 660.
You can also edit the file and add code to it.
Once you have opened the .htaccess file with a text editor, simply insert this code.
# 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
Contact Your Hosting Provider
If neither of the solutions above has fixed the WordPress posts returning 404 error, then we recommend contacting your WordPress hosting provider. There may be an error on their end, or they might be able to help you troubleshoot the problem.
Please also see our guide on how to properly ask for WordPress support and get it.
Fix for Local Servers
If you are using a local server for testing purposes, then you will need to enable the rewrite_module in the Apache configuration of your MAMP, WAMP, or XXAMP site.
We hope this article helped you resolve the posts returning 404 error in WordPress. You may also want to see our guide to the most common WordPress errors and how to fix them, along with our expert picks for the best WordPress plugins to grow your site.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.
Farid says
Thank you very much for precious article that is useful to fixed my website problem.. i always prefer your web solution regarding in problem in wordpress cms.
Thank you..;.
WPBeginner Support says
You’re welcome, glad our guides have been helpful
Admin
Ben says
Just wanted to leave a thank you comment! Your guides on WordPress are second to none! I have learnt so much reading your blog and every time I Google a problem..I am looking for your website and that is where I will click! Great and simple instructions even on the most complicated WordPress issues…you are awesome! Thanks.
WPBeginner Support says
You’re welcome, glad you like our content and hope our guides continue to be helpful
Admin
David Naugle says
This totally worked! I just updated my PHP and dashboard and home pages was accessible but not any of my post pages.
Thx
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Vivian S. says
Thank You so much it saved my life! I had to move my WordPress website to a new server and it took me a whole day to fix everything. I wish WP had an easy way to do this.
WPBeginner Support says
Glad our guide was helpful, for transferring your content you would want to take a look at our article below:
https://www.wpbeginner.com/wp-tutorials/how-to-move-wordpress-to-a-new-host-or-server-with-no-downtime/
Admin
Gustavo says
Thank you guys, you’re AWESOME, ALLWAYS!
WPBeginner Support says
You’re welcome
Admin
Don Current says
I tried everything in the article with no success. What I ended up doing was choosing a different Permalink structure and saving it, and then going back to the structure I wanted and saving it. Then all was well.
WPBeginner Support says
Thanks for sharing the method that worked for you
Admin
James says
I accidentally deleted .htaccess file when doing 301 and got the 404 not found error. Your tutorial came to my rescue. Just by saving the permalinks and it worked. Thank you.
WPBeginner Support says
You’re welcome, glad our guide could help
Admin
Ivan says
Saved me! I am dealing with forces I cannot comprehend, and this explanation and tip was really helpful!
WPBeginner Support says
Glad our guide was helpful
Admin
Uwemedimo Usa says
Wow, I’m shocked at how fast this worked. I recently migrated my site from a subdomain to the root domain and none of my links were working. All I did was go to permalinks in settings and click “save changes.” That was all. Wow. And I was really scared I’d broken something. Thank you.
WPBeginner Support says
You’re welcome, glad we were able to help
Admin
DNNY says
What do you do if you cant even get into your WP
dashboard
WPBeginner Support says
For that, you would want to take a look at our article below:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Katie says
Hi, thanks for the tips. I still can’t seem to fix the error. Have reset Permalinks, installed a redirect plugin (doesn’t help if wanting to redirect to the homepage). I can’t work out how to alter the .htaccess and not really confident to do it. Any other suggestions?
WPBeginner Support says
If you are using a static page ensure it is published, for the htaccess you would need to use FTP or your host’s file manager, otherwise, you would want to follow our troubleshooting guide below:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Fola says
Thanks You saved me a lot of hassles
WPBeginner Support says
You’re welcome
Admin
Jill says
THANK YOU for this post! I had a primary domain that I let go and needed to move two sites on my hosting plan…. 1 to the primary domain position and 1 to an addon domain position which was formerly a subdomain position. I broke a lot of stuff. With some logical thought, I got most of it all back… EXCEPT all the pages on the primary domain site couldn’t be viewed on the live site once you clicked on them or the menu links. The home page loaded beautifully, but when you clicked a post or link… the errors popped up. This trick resolved those issues… so THANK YOU again! You saved the day!
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
umesh says
I just change the permalink directly and it shows 404 error I couldn’t access my website it redirects me to another site which is not mine
WPBeginner Support says
You would want to reach out to your hosting provider to ensure your domain is set up properly and there isn’t any malicious code on your site.
Admin
faheem says
404 Not Found
nginx/1.10.3 (Ubuntu)
please give me solution for that
WPBeginner Support says
For nginx, at the moment you would want to reach out to your hosting provider and they should be able to assist.
Admin
Carene says
I’m busy building a website via wordpress & cpanel. I by accident deleted the url in my dashboard. Now I don’t get even access. Is their any way to fix it.
WPBeginner Support says
You would need to edit your site via phpMyAdmin similar to the article below. Instead of the users table you would need to edit the options table where you can readd your site address and url.
https://www.wpbeginner.com/beginners-guide/how-to-reset-a-wordpress-password-from-phpmyadmin/
Admin
Long Nguyen-Vu says
Just want to let you know that you’ve helped me save a lot of time searching.
Thanks so much.
WPBeginner Support says
You’re welcome, glad our guide was able to help
Admin
Jim says
OMG I LOVE YOU
updating the permalinks and all is gold
THANK YOU
WPBeginner Support says
Glad our guide was able to help
Admin
Brandon G. says
Updating permalinks fixed my 404 errors. Thanks!
WPBeginner Support says
You’re welcome
Admin
Musthafa says
Updating the permalink worked perfectly. Thanks guys!
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
ami says
thanks its is working
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Heather says
Simply saving changes in my permalinks did the trick. Thank you!
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Ekemini Robert says
After saving changed for the permalink, it still returned the 404 error. Then I used the clear cache WP button at the top and the problem was solved.
WPBeginner Support says
Glad you were able to resolve the issue
Admin
Didar says
Thank you so much !
WPBeginner Support says
You’re welcome
Admin
Ashish Agarwal says
Thanks so much for this post. You are a lifesaver. Clicking ‘Save Changes’ on Permalinks under Settings did the job for me.
WPBeginner Support says
Glad our recommendation was able to help
Admin
Alex says
I have issues on 404 Page not found.
I tried updating the permalinks but still not working and I also checked the .htacess file in our server and it’s the same on the above sample. But still not working.
WPBeginner Support says
You may want to reach out to your hosting provider to ensure there are no issues on their end that could be a part of the issue
Admin
Luiz Felipe says
This simple solution saved me! thanks!!!!!!!
WPBeginner Support says
You’re welcome
Admin
Steve Dzwonczyk says
The 2nd method worked for me (FTP and edit of the .htaccess file). Thank you very much.
WPBeginner Support says
You’re welcome, glad our recommendation was helpful
Admin
Pranesh says
Thank you very much
WPBeginner Support says
You’re welcome
Admin
Anas says
Thank you so much for this helpful tip. Was really bugging me a lot
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Michelle Kwok says
thanks a lot.. it’s weird.. works at step one =)
WPBeginner Support says
You’re welcome, glad our recommendation was able to help
Admin
Steph says
This worked at step 1. Thank you!
WPBeginner Support says
You’re welcome, glad our guide could be helpful
Admin
Ishmael says
Many thanks, solved my problem.
WPBeginner Support says
You’re welcome, glad our guide was helpful
Admin
Shiraz says
This article helped me bring my website back on. Thank you.
WPBeginner Support says
You’re welcome
Admin
mariam says
Thanks for this post,it really solved my 404 error problems
WPBeginner Support says
Glad our recommendations were able to help
Admin
Tim says
Just a quick note to say thank you so much! I had just activated a CDN (learning as I go) and thought I had broken my site and went searching everywhere but here was the answer…phew!
WPBeginner Support says
Glad our guide could help
Admin
Lou Sarmiento says
Hi!
I’ve added the htaccess script, updated my wordpress but still I need to resave the permalinks. Any other solution?
Thanks!
WPBeginner Support says
If these solutions are not working, you would likely need to ensure there isn’t an error on your host’s end or you could try the recommendations in our troubleshooting guide here:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Ayesha says
i have 404 error but cannot acces neither the site or the wordpress. how can you access wordpress admin to solve the problem??
WPBeginner Support says
If you’re unable to access your admin area, you would want to go through our guide below or reach out to your hosting provider:
https://www.wpbeginner.com/beginners-guide/beginners-guide-to-troubleshooting-wordpress-errors-step-by-step/
Admin
Nera says
Lifesaver! It worked! Flushing permalinks! Haleluja… THANKS!
WPBeginner Support says
Glad our recommendation could help
Admin
wajid virk says
on clicking save changes my problem Resolved, WP beginner is a part of my journey to learn WordPress more and more.
WPBeginner Support says
Glad we can be here to help
Admin
Safa says
You just saved me, Thanks
WPBeginner Support says
You’re welcome
Admin
Nora says
Thank you so much! This saved our corporate website
WPBeginner Support says
Glad our article was helpful
Admin
Mary Ann says
Will it work in 404 error of WordPress Multisite once I visit the admin dashboard of the sub-sites?
WPBeginner Support says
It would depend on the source of the error but this can certainly be one solution.
Admin
beginner says
Thank you, it solved the issue straight away!
WPBeginner Support says
Glad our article could help
Admin
Civali says
.htaccess example worked for me, tks!
WPBeginner Support says
Glad our recommendation could help
Admin
Vishwajeet says
So I checked all solutions and comments. I have same issue with a twist. I can see the pages when I am changing it to use the Page ID but not when I am selecting the Post-Name? Any solution to this? I know its weird.
WPBeginner Support says
You may want to delete the current htaccess file and if that does not fix the issue, reach out to your host to ensure there isn’t an underlying error causing the problem.
Admin
Mireille says
Hello,
I just wanted to let you know that your website is of such great help ! I built my first WordPress website and I managed to resolve many issues thanks to your articles. Thank you !
WPBeginner Support says
Thank you, glad our articles have been helpful
Admin
Benson Kanyi says
Hello Guys,
I have been facing this issue for the last three days after migrating a new site from my localhost to an online CPanel server. Having tried a million and one option from various forums, none of them could work at all. The only solution that seems to work is disabling Mod_Security in the CPanel. I just did it and it works like a champ. Thanks
WPBeginner Support says
Thanks for sharing the solution that worked for you
Admin
hüseyin says
I worked for days. It happened. cpanel mod security disable. solved the problem. Thanks BENSON
Christopher says
Worked! Thanks!
WPBeginner Support says
Glad our recommendation worked for you
Admin
Peter says
you blog saved me from disaster thanks so much. im learning so much now
WPBeginner Support says
Glad our recommendation could help
Admin