Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

How to Fix WordPress Posts Returning 404 Error (Step by Step)

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 WordPress posts returning 404 errors.

How to fix WordPress posts returning 404 error

Why Are My WordPress Posts Returning a 404 Error?

There are several reasons why your WordPress posts might be showing a 404 “Page Not Found” error. These can include:

  • Plugin or theme conflicts: Sometimes, plugins or themes you’ve installed on your site can interfere with how WordPress handles permalinks. This can lead to broken links and 404 errors.
  • Custom code issues: If you’ve added custom code to your website, there might be errors in the code that are affecting permalinks or causing other conflicts, resulting in 404 errors for your posts.
  • Issues with your .htaccess file: The .htaccess file plays a role in how WordPress structures URLs. If this file is corrupted or missing, it can lead to 404 errors for your posts.

That being said, let’s look at how to fix WordPress posts returning 404 errors. You can use the links below to jump straight to different solutions:

Don’t want to fix 404 errors yourself? WPBeginner Pro Services can help! With our affordable Emergency WordPress Support, you can hire experts to fix 404 errors, broken links, redirect issues, and much more. Stop stressing over WordPress issues and get them fixed! Schedule Emergency WordPress Support Services today!

Video Tutorial

Subscribe to WPBeginner

If you prefer written instructions, then just continue reading.

Method 1: Check for Plugin or Theme Conflicts and Custom Code Issues

Sometimes, plugins, themes, or custom code you’ve added to your WordPress site can interfere with permalinks or cause conflicts, leading to 404 errors. We’ve even experienced it ourselves when we’re testing tools on our demo site.

One way to solve this problem is to temporarily deactivate plugins. Plugins can sometimes disrupt how WordPress handles links.

Once you’ve deactivated the plugins, you can reactivate them one by one while checking if the 404 error reappears after activating each plugin. If the error shows up after activating a specific plugin, that might be the culprit.

You can then search for solutions related to that plugin or contact the plugin developer for support.

Similarly, your WordPress theme might be causing the conflict.

To check, you can temporarily switch to a default WordPress theme like Twenty Twenty-Three or Twenty Twenty-Four. All you need to do is go to Appearance » Themes and click ‘Activate’ on a default theme.

Activating a default WordPress theme

If the 404 error disappears with the default theme, it indicates a potential conflict with your current theme. You can then try troubleshooting the theme or consider using a different theme.

You can check out our expert pick of the most popular WordPress themes for recommendations.

If you’ve recently inserted code snippets to your website, there might be errors in the code causing the 404 errors. Take a close look at the code you added and see if you can identify any mistakes.

The safest way to add code snippets to WordPress is with the WPCode plugin. This plugin lets you insert custom code without directly working with the theme files, reducing the risk of breaking your website.

Plus, whenever WPCode spots an error in your code, it will automatically deactivate the snippet and ask you to check it. You can also use the testing mode to check if your code works before pushing it to your live website.

WPCode error warning

If none of these solutions work, move on to the next method where we’ll troubleshoot 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.

Check Permalinks

There is no need to make changes to the permalink settings themselves. 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.

Method 3: Update the WordPress .htaccess File

Before you start, make sure to back up your WordPress .htaccess file first. If something goes wrong, you can easily restore the original file.

Now, you will need to connect to your server using an FTP client like FileZilla 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.’

.htaccess 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’.

Change file attributes for the .htaccess file to 666

Then, you need to repeat the steps in the first method 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.

Edit .htaccess file

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

Method 4: 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.

Method 5: Fix WordPress Posts Returning 404 Error on Local Servers

If you are using a local server for testing purposes, then you will need to enable mod_rewrite in the Apache configuration of your MAMP, WAMP, or XAMPP site.

This will allow WordPress to generate clean URLs and prevent the 404 error for posts and pages on your local server.

How you do this will differ by the platform you use. People using XAMPP can open their control panel and click the ‘Config’ button within Actions. Then, select ‘Apache (httpd.conf).’

The Apache (httpd.conf) menu on XAMPP

Next, you will need to find this line #LoadModule rewrite_module modules/mod_rewrite.so and remove the ‘#’ to uncomment it.

This will load the mod_rewrite.

Finding the rewrite_module on httpd.conf file

Then, find all instances of AllowOverride None and change them to AllowOverride All.

The ‘All’ value means that all directives can be overridden.

Changing AllowOverride None to AllowOverride All

Once done, you can save the httpd.conf file and close it. After that, in the XAMPP control panel, click ‘Stop’ on the Apache module and ‘Start’ again to restart it.

Then, go back to your admin dashboard to see if your permalinks are working.

We hope this article helped you resolve the posts returning 404 errors 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.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

772 CommentsLeave a Reply

  1. Mario Nwolisah

    Thank you! It worked. I really appreciate.

    • WPBeginner Support

      Glad our article was helpful!

      Admin

  2. Jess

    Thank you – this saved me!

    • WPBeginner Support

      Happy to hear our guide could help!

      Admin

  3. Cristian

    Thank you, it works for me!!!

    • WPBeginner Support

      Glad our recommendations were able to assist!

      Admin

  4. Samir K Al Busaidy

    I was panicking and thinking that my website was hacked or had malware. As I read your writing and you wrote not to worry, I began to relax. The first option (permalink) worked for me immediately…
    Thanks :-)

    • WPBeginner Support

      Glad our guide was able to help :)

      Admin

  5. Udaykumar Posia

    This worked. Thank you so much.

    • WPBeginner Support

      Glad our guide could help :)

      Admin

  6. Max Legault

    On IIS there is no .htaccess file but the key is still the permalink settings. Just hitting Save didn’t fix it but changing the Custom Structure to Plain worked like a charm. Thanks for the push in the right direction.

    • WPBeginner Support

      Glad you were able to find the solution for your issue :)

      Admin

  7. Collin

    I love you for this! This was an easy fix. I was in full panic mode!

    • WPBeginner Support

      Glad our guide was able to help :)

      Admin

  8. Zack

    Thank you so much. It worked!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  9. Steve Barnard

    Dang! Can’t thank you enough for this – super simple fix worked perfectly – just hit save changes on the permalinks settings page and viola’ – my pages are back. Thank you!!

    • WPBeginner Support

      Glad our guide could help :)

      Admin

  10. A.S.M. Arifur Rahman

    Thanks a lot, settings saved method works, Now my post open fine.

  11. kris

    honestly thank you so much! without fail your site always comes thru with answers that work. thank you so much!
    (now I just wish I knew what caused it to get out of whack in the first place. oh well.)

  12. Chris

    This article just saved me from a panic attack Lol. The solution worked great. Thanks for making this video.

  13. Muhammad Tahir

    i didn’t solve this issue by using all the methods that you are discussed?

    • WPBeginner Support

      If none of our methods in this guide worked for you, we would recommend reaching out to the support for your hosting provider to ensure there is not an error on their end.

      Admin

  14. Duane Wiese

    None of the above suggestions worked so I did some further searching. I came across someone who suggested switching off the mod security under the security section in cpanel.

    I tried this and it worked. I also tested it by switching it back on after a change and then trying another change and BAM, 404 error.

    • WPBeginner Support

      Thanks for sharing this should someone else run into this issue. Not every host allows access to that specific file but if you reach out to your host they can normally disable or change it for you :)

      Admin

    • Dave Emma

      Disabling ModSecurity fixed mine.
      I actually tried permalinks plus rewriting .htaccess, but that didn’t solve my problem. I’m glad I read comments. Many thanks guys for sharing.

  15. Elango

    Thanks, it was so simple and the problem solved. No other pages were visible after I migrated to another server. I added the lines to .htaccess file and uploaded the same. Now all the pages are being displays without the 404 error and I am able to access my WP dashboard too. Thanks a lot.

    • WPBeginner Support

      Glad our guide was able to help :)

      Admin

  16. Islombek

    My posts are showing 404 error after installing ssl certificate. How can I fix it? I tried everything mentioned above, but none helped.

  17. Dennis Yildirim

    My .htaccess file is exactly the same with that code but nevertheless I did whatever in the post. did not work, saved permalinks through admin console, did not work. Manually edits, no luck. Deleted the .htaccess and recreated it by saving it from admin console, again did not work. Nothing works. Don’t know how did it even work on others?

    • WPBeginner Support

      If none of the recommendations from our article were able to help we would recommend reaching out to your hosting provider as that can be a sign that there is an issue on your host’s end.

      Admin

  18. Kuldeep Singh

    You saved my day. I got this issue after transferring my site from one hosting to another. I couldn’t believe it was so simple to fix the issue. Many Thanks WpBeginner team!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  19. Rick

    I never reply to these things but just wanted to jump on here and say thank you! I’ve been having this issue a lot and having to wait ages for support to help me and so finally had a hunt around, found this, and can now fix it myself. You legend!! Much appreciated

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  20. Elroy

    Thanks a lot Wpbeginner it woked just fine.

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  21. Noble

    Thank you very much, it worked instantaneously!

    • WPBeginner Support

      Glad our guide could help :)

      Admin

  22. carol hannah

    Help! It didn’t work and I can’t possibly work out how to do the .htaccessfile thingy?

  23. Christopher Krohn

    Thank you, thank you, thank you!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  24. Dan

    Man this fixed my WP site! THANK YOU!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  25. Molly

    Thank you for a million time!!!!!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  26. Amin Omer

    Thank you very much

    • WPBeginner Support

      You’re welcome :)

      Admin

  27. Afan

    One of solutions to correct the issue with the Permalink change is simply delete the .htaccess file – Wordpress will recreate it again automatically.
    But, before you delete it, copy the file on your computer, just in case…

    • WPBeginner Support

      If someone has customized their htaccess file then that would be a good idea. Otherwise, WordPress should auto regenerate the default information in the file where most wouldn’t need to worry.

      Admin

  28. James Monroe

    Saving the permalinks settings worked perfectly. Such a simple solution to what looked like a serious problem! Thank you!

    • WPBeginner Support

      Glad our recommendation was helpful :)

      Admin

  29. mukhtar

    its works fine 100 %
    and easy to solve my problem, we are very very thankful to you about it

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  30. Sarah

    Wow!! I’ve spent all evening trying to fix this and that’s how easy it was! THANK YOU!!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  31. Rimzan farook

    Thanks fixed it as you described changed my post date to post name, thanks a ton

    • WPBeginner Support

      Glad our recommendations could help :)

      Admin

  32. Muhammad Zeeshan

    I’m facing 404 error while adding new plugin , theme , editing any post or product, editing any page ..
    I’ve try to save permalinks and also tried to change .htaccess .. But not this given solution is working for me.

    • WPBeginner Support

      You would want to reach out to your hosting provider to see if you are running into any errors on their server’s end.

      Admin

  33. Ayobami

    I’m having error 404 issues on my website, I can’t access to the website at all what can I do?

    • WPBeginner Support

      You would use the htaccess method from this guide or reach out to your hosting provider to be able to assist you

      Admin

  34. samith

    I can’t login my WP dashboard seen “nginx 404 not found error”

    • WPBeginner Support

      For that specific error, you would want to reach out to your hosting provider to take a look.

      Admin

  35. Sammy

    A BIG Thank You… It solved the headache!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  36. Mihir

    I’m facing a problem where this is extension of my own website after every page and I don’t know how to fix it.

    • WPBeginner Support

      You would likely want to check under Settings>Permalinks to ensure everything is set correctly there

      Admin

  37. Daniel

    Thank you,
    It solved my problem!

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  38. Mellissa

    This is a great solution but it didn’t fix my issue so in case anyone else is in the same boat, here’s what went wrong for me; my index.php file went missing from the server. Added a new copy and everything is back

    • WPBeginner Support

      Thanks for sharing what worked for you :)

      Admin

  39. Brahim

    thank you, that help a lot

    • WPBeginner Support

      You’re welcome :)

      Admin

  40. Logan

    Thanks for your articles. My issue is that I can’t log in to my website even though I’m logged in to the host server… When I try to log in my wordpress the message goes :

    Not Found

    The requested URL was not found on this server.

    My website isn’t published yet as I’ve just started.

    • WPBeginner Support

      You would want to check with your hosting provider to ensure there isn’t an issue on their end or where your site is installed

      Admin

  41. Danish

    My main page is working but all other pages are showing 404 error. They are visible in admin panel but can’t view them.

  42. Peck-Secia Tangi

    Hi,

    Below is the error that i am getting which is similar to the one described above

    “The requested URL was not found on this server.”

    • WPBeginner Support

      For that error, if you haven’t done so already you would want to reach out to your hosting provider to see if the error could be server related.

      Admin

  43. Kathryn

    This worked beautifully. Thank you!

    • WPBeginner Support

      You’re welcome, glad it helped :)

      Admin

  44. Parvinder Singh

    Yes, WPBEGINNER rocks !!!!

    • WPBeginner Support

      Glad our guides were helpful :)

      Admin

  45. clay

    Crazy how helpful this article is. Such a simple solution to a very frustrating problem.

    • WPBeginner Support

      Glad we could help make the solution easy :)

      Admin

  46. Shoeb Khan

    This is very helpful thank you.

    • WPBeginner Support

      You’re welcome :)

      Admin

  47. Calvin

    I’m having the same problem with category links. They return a 404 error and it’s a new website. I’m afraid not all pages are going to be indexed.

  48. Oluebube

    This was very helpful…

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  49. Dominus MMP

    Thanks, this was helpful for me.

    • WPBeginner Support

      Glad our guide was helpful :)

      Admin

  50. Ian

    I just build my website. I was able to go into dashboard. I changed the url (IP address) to my domain. Now mydomain.com and mydomain.com/wp-admin give me “Not Found”.
    Any suggestions? Thanks.

    • WPBeginner Support

      If your site is on your hosting provider you would want to reach out to your host’s support to ensure the site is in the correct location and your domain is pointing correctly.

      Admin

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.