Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Fix WordPress Posts Returning 404 Error

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Fix WordPress Posts Returning 404 Error

WordPress is a powerful CMS. Sometimes a slight tweak can make your website inaccessible. However, finding a solution for any WordPress problem is extremely easy (check out how to properly ask for WordPress support and get it). In the past we have covered some of the most common problems WordPress users face. Like the internal server error or error establishing database connection. Another common problem that most WordPress users face at some point is WordPress posts returning a 404 Error. In this article we will show you how to fix WordPress posts returning 404 error.

Fixing WordPress posts returning 404 error

Usually in this scenario a user can access their WordPress admin area, their blog’s main page, but when accessing a single posts they get a 404 Not found error. First of all, don’t panic most of the time your posts are still there and completely safe. This usually happens if your .htaccess file got deleted or something went wrong with the rewrite rules. What you need to do is fix your permalinks settings.

Go to Settings » Permalinks, and simply click on Save Changes button.

Update permalink settings

This will update your permalinks settings and flush 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.

Login to your server using FTP, and modify the .htaccess file which is located in the same location where folders like /wp-content/ and /wp-includes/ are located. The easiest thing you can do is to temporarily make the file writeable by changing the permissions to 666. Then repeat the original solution. Don’t forget to change the permissions back to 660. You can also manually add this code in your .htaccess file:

# 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

Fix for Local Servers

Often designers and developers install WordPress on their computers using a local server for testing purposes. If you want to use pretty permalinks, then you need to enable the rewrite_module in the Apache configuration of your MAMP, WAMP, or XXAMP.

We have written a tutorial here on how to enable custom permalinks in WordPress local environment.

We hope this article helped you resolve posts returning 404 error in WordPress. Did this solution work for you? Do you have another solution that worked for you? Please share it in the comments below. We would like to make this article a comprehensive resource for users who run into this issue.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Shashdhar S says:

    Thanks a lot , the second option worked for me ….. Thank you so muich :-)

  2. eliana says:

    Just THANK YOU!


  3. Michaela says:

    hi, I tried first solution, nothing happened. I wanted to try the second, but I cannot find the .htaccess file. Not in FTP, not even in my WP online editor. I had this issue today for the first time. I use WPML plugin, until now everything went without problem, but today my translated post in English throws this 404 Error. Any idea what shall I do if I cannot locate the .htaccess file?

  4. Shirish Dhungel says:

    Well thanks! I remember, that WP Super Cache official stated to remove rewrite code from .htaccess. After that, my posts redirected to 404. Thanks to you, now my site is perfectly fine.

  5. Muhammad Nasir says:

    Thanks it worked for me, thank you so much.

  6. Akhelesh says:

    Do I have to remove the code snippet I added to htacces file after my problem has been solved?

  7. Jessica says:

    Can someone contact me please? I am so new to these I don’t even know what a FTP server is…

  8. Rohan khamkar says:

    Sir, when I post a new post it gives me error that 404 page not found. Previously everything was fine but when I add a new user and give him a role of administrator from that time I can’t post new post. Any solution Please. Thank you in advance.

    • WPBeginner Support says:

      You should never give administrator role to a user you don’t trust. You can always change back their role by going to Users page and then clicking on the Edit link below the user that you want to change. After that you check your site’s permalink structure. See if they installed any new plugin and if they did, then deactivate that plugin.

  9. Shivani Sehdev says:

    Wow……….. Solved a long ago problem .
    Thanks A lot.

  10. R Donahoo says:

    Didn’t work on my apache server. Had an additional step to allow mod_rewrite to actually work. Edit your httpd.conf file and add ‘Allowoverride all’. For example:

    DocumentRoot /var/www

    find the section that sets up the directory options, such as:

    Options Indexes FollowSymLinks MultiViews
    Order allow,deny
    allow from all

    add Allowoverride all

    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    Order allow,deny
    allow from all

    save and restart the web server to re-read the updated configuration.

    All was well after that.

    Thanks for your useful post moving me into the right direction.

  11. aderele olutayo samuel says:

    this worked. …. Thanks

  12. Eva says:

    I found the some problem. However, I could not log in to the admin page. Could you give solution to mitigate this problem?

  13. Rodrick Green says:

    This was very easy and very helpful. THANKS A LOT!!!

  14. B Pandey says:

    thanks for your usefull tip. It worked for me on my website. Thanks a lot

  15. sheldon says:

    Thank you .
    It worked for me

  16. Rachit Sharma says:

    but not working for me when i updated permalink with post name and change .htcces file but not worked. any other solution for that.

  17. Ahsan says:

    Wowww Thank you so much, that was really helpful.
    In my case it was WAMP server, after turning on “rewrite module” in apache, my problem was solved.

  18. Kailash says:

    Wow – this still works. Done a search on google and found articles in wordpress but this was by far the simple-est and bang it works.

    Thanks a mill – saved me a heap of time

  19. Shawn Ritch says:

    Hello and thanks for all the useful tips. Unfortunately, this tip didn’t work for me. I re-saved my permalinks in WordPress settings (didn’t work) so then I tried your next method and it didn’t work either. I’m thinking the reason for this is because I have different permissions. My original permission is 644. When I change permission to 660 none of my pages work so I believe the 666 permission is wrong as well. I’m using a Go Daddy server if that helps any :/

    I’m at a loss and have no idea what to do from here. However, I can’t afford to have pages that don’t work. Any suggestions would be greatly appreciated.

    Shawn Ritch

  20. Kevin Garcia says:

    I tried this and it didn’t help me!!! My whole website crashed and had to restore it!!

  21. Hannah Brown says:

    Thanks, yours was the only place that told me HOW to fix my broken links! You’re the best

  22. Kunal Yande says:

    Thanks !!
    You save my so much time….

  23. Chris says:

    How do I fix the issue when I upload a new plugin and then my categories, not posts, become 404?

  24. Bob says:

    This is great advice. I thought I was going to have to take a deep dive, but two clicks and I’m GTG. Thanks!

  25. Ronn Reason says:

    i keep getting this message with my email account;

    Error Oops… a server error occurred and your email was not saved. (#404)

    Please advise ASAP

  26. Gabo says:


    I can’t belive this …. it works, thanks !!!!!

  27. Steve says:

    I had this problem after moving sites to a new server. Default Permalinks worked, but not the settings I was using.

    I needed the apache server to “Allow Override” for the htaccess file to take effect.

  28. Vivek says:


    I need a little help regarding 404 error.

    I am getting 404 error in my Page 2 section.

    I have googled a couple of times. but did not get the solution.

    Could you please tell me what is the reason for it?

  29. Rudy says:

    My site links will work ONLY after I’ve VIEWED the permalink settings, without any changes, and Voila! The links work again. What is causing this and how can I program this instead of having to log in?

    I’ve tried the following commands in WP-CLI to no avail:

    wp rewrite flush –hard –path=c:\xampp\htdocs\mywordpress

    wp cache flush –path=c:\xampp\htdocs\mywordpress

  30. Amit Schandillia says:

    This saved my life!!!!!

  31. Patrick says:

    Thanks man, just pressing the “Save changes” on the permalink-settings page did it for me! Cheers!

  32. Amanda says:

    Hi there,

    About an hour ago I was able to remedy a pesky ‘500 Internal Service Error’ by following your sage advice and renaming the .htaccess file to .htaccess_old. I was immediately able to access my wp-admin area–and I thought–get going again.

    Unfortunately, something happened which rendered all of my other pages unfindable; each kicking a 404 error.

    I attempted the steps you provided above, but to no avail. Might you have any further suggestions?

    Thank you.

  33. Jessa says:

    You guys are awesome, this was easy and fast. You guys save me a trouble!

  34. mehdi says:

    why i coudl not see my post?
    after I send a post my preveous posts appear.
    it made me crazy please remove previous post

    I found a solution to my problem and will say in next post

  35. mehdi says:

    Hello agin
    thank you for this useful article/ I found a bug in wordpress in rtl language in displaying permalink
    I read your article and encourage to solve the problem with your contribute.
    my problem in detail:
    1-I created a mysql database(in utf8 general ci)
    2-I installed last wordpress versin(locally) and install my theme(multiup v 1.2 from themeforst)
    3-Next I did import demo as whele.
    in the theme admin panel exixst category portfolio (in this section we create our category with name and slug) then in all post under portfolio section we can create our posts and determine category of post from portfolio category) finally in homepage we have a section that shows portfolio post in category(with their picture)
    In english slug and name the category of portfolio show well but when i change category in portfolio category( slug) into rtl language the category in homepage canvert into charachter like base 64(I think that my slug convert into ansi ie each character convert into 6 charachter)
    How I can overcome my problem?I think I must avoid change slug or show slug into utf8 or unicode . I am beginer in wpordpress , If I khnew wordpress more I could solve this simple problem .Any one with khnowledge of handling hoock and filter and plugin and wordpress can solve this permalink problem . I sure I will solve this problem with your help.
    I tried the second way you offer (that phpmyadmin in utf8generalci) but it doee not work for me.
    before thansk a lot for helping me.I followed your posts regularly .
    1- first I did the trick in above article (this is so good but didnot solve my problem)

  36. mehdi says:

    thanks to contribute you knowledge to others .my english is not well.excuse me.
    I download a wordpress theme with portfolio link in admin panel that in porftoli section we can define some category with name and slug . in post we can determine category from portfolio.
    in homepage we can display post in portfolio category! all thing is ok but wen i chang name and slug into rtl language the title of a group in home page shows like this %d8%a8%d8%b1%d9%86%d8%af%d8%b3%d8%a7%d8%b2%db%8c
    i did your solution in this topic and that another topic(How To Enable Custom Permalinks) but not woks for my problem!

    • WPBeginner Support says:

      This could happen if your WordPress database is not using UTF-8 character encoding. Please make sure that your database is using utf8_general_ci as collation. You can check that using phpMyAdmin from cpanel. Before you make any changes to your database, please create a complete WordPress backup first.

  37. Atula Gupta says:

    Thank you so much for fixing my problem in seconds! I was panicking about all my posts giving this error and this solution was so simple! Thanks again.

  38. Sammy says:

    Thank you, thank you! This was making me crazy and you just helped me fix it in 2 seconds. High five.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.