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. Robert

    Well, your tip saved me hours of searching – many thanks

  2. Nima Arefi

    Thank’s you saved my life :d

  3. Juan

    Hello, I have a problem since I migrate the website from localhost to a server, the main page looks good but the menu is not displayed but the links do not work always throws error 404.
    They can help me, this is a cause of a migration from a local server.

  4. Marissa

    I can’t thank you enough for such a simple tutorial!! Everything else I found made it seem so difficult. I recently switched from http to https and it has been one problem after another..

    • WPBeginner Support

      Hi Marissa,

      Glad you found this tutorial helpful. Don’t forget to join us on Twitter for more WordPress tips and tutorials.

      Admin

  5. Rick

    I didn’t have an .htaccess file so I created one with the info you provided above; then uploaded it and the site works perfectly again. Thanks!

  6. Curtis

    Hi I have done all the above and noticed the bit of text to copy and paste was already in there! It still is not working and im stressing out!

    • Tibi

      I’ve done the same thing and nothing changed, the home page still not found :(

      Please contact me if you find a solution

  7. Patrick

    Wow. This really saved my bacon. Thank you so much for the tip on simply saving the permalinks page. Incredible advice! :)

  8. Alexis

    hello! i’ve reset permalinks many times to deal with the 404 error. this time when i hit save a file downloaded to my computer: options-permalink.php and the site broke. just got a white screen and each time a file downloaded. finally i got the default permalinks to work but this is not a great solution. does this sound familiar to you? tech support didn’t think it was the .htaccess file but i’m not convinces. moved site from one host to another. any help would be much appreciated.

  9. Mike Birdsall

    How do I update settings if I can’t log into the WP admin. I get the 404 error when going to /wp-admin

  10. Kelly

    So helpful!! thank you!!!!!!

  11. seun

    Hello, please help, i seem not getting solution through this tutorial cos i can’
    t access my dashboard, i keep getting this message any site directory i open.

    Not Found

    The requested URL /index.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  12. Clint

    Thank you, just clicking save on my permalink page (which has been customised for years) worked immediately.

    • Chris Keeble

      Perfect!

      Clicking Save Changes on Settings > Permalinks works first time.

  13. tamim

    Wow! that’s a great solution.

  14. Jason

    Hi, I was having the 404 error problem. Homepage works fine, all other links have the 404 error. Tried the method you suggested in wordpress settings permalinks and click save changes but it didn’t work for me.

    Saw some post earlier about sync the htaccess file through the webhosting settings page somewhere but don’t really know how to do it. Any advice? Thanks

  15. Mohamad Zidani

    Hi

    I was using Fv Top Level Cats, when i removed still redirection worked from

    example.com/category/tech to

    example.com/tech.

    i try your solution and it doesn’t work.

  16. Joerg Naussed

    the 404 appear right away what happen?

  17. Tamara

    That worked!! Thank you

  18. Lijo Jose

    Thank you, My problem was solved

  19. Mariana Cervantes

    Thank you so much!!!! My problem was fixed with the permalink solution :)

  20. Michael

    If this error is affecting your login page, go to .htaccess and remove:

    “deny from all”
    “allow from 00.00.00.00”

  21. Matt Kay

    Fantastic – I had moved my site from one server to another and started getting worried about 404 errors. The fix worked perfectly – so easy!

  22. Bienvenido

    A very simple answer to a hair pulling issue. Thanks a bunch. BTW this issue started after I installed BJ Lazy Loading.

  23. Gail Gardner

    Thank you! This did the trick.

  24. Ahmed

    Hi, One of my site was hacked. There was few hundreds article inserted. Now those has been removed. Google webmaster console showing those as 404.

    How this can affect my site how to fix this?
    Thanks

  25. Stephanie

    Wow, thank you! This worked perfectly.

  26. Mawuli Tanor

    Spot on! On the dot!
    First fix worked.

    Thanks a lot!

  27. Peter Mazzi

    Thanks. pity there’s no rating on this page. *****

  28. David M. Curtis

    Thank you for posting this article. I had spent months building a store / blog and today none of my pages or posts were working other than the front home page, all other links were taking me to a 404 error page. I was about to start completely over – re-peat months of work. This article saved my site. Now everything is working again. I can’t thank you enough.

    • WPBeginner Support

      Hi David,

      We are glad you found the article helpful :) Don’t forget to join us on Twitter for more WordPress tips and tutorials.

      Admin

    • Robin

      Hi there, completely stuck here, not a computer guy at all so it’s all greek to me. my homepage is good but I’ve created another 5 pages such as blog post, services, etc. and every time I try to view the page I’ve just created I get NOT FOUND The requested URL /services/ was not found on this server.” I’ve tried saving changes didn’t make any difference and I have no idea what an FTP is. Any help ? thx

      • WPBeginner Support

        Hey Robin,

        Try updating your permalink structure. Simply visit Settings » Permalinks and then click on the save changes button without changing anything.

        Admin

  29. Preet Karan

    Hi everyone,

    i installed yoastseo plugin. i generated the XML site successfully, but when i tested it on google search console it is showing 404 error.

    i tried the method listed in article but the problem still persist.
    also i need to mention that in the CCpanel there are two files of the same name htaaccess and htaaccess.1 (with the same code written that has been mentioned by article above ); is it normal,
    can you help me wth the issue

  30. David

    I can’t believe just clicking “Save Changes” worked. Thanks!

  31. jorge

    hello there im I would really appreciate help I followed the instructions on saving changes on permalinks not a computer person so do not know how to do the other after is showing me this

    Fatal error: Class ‘Epsilon_Editor_Custom_Control’ not found

  32. yugal joshi

    great man..thank you much.. i open my site but its throwing 502 error then 503 error and then lastly 500 error..then i solve the problem of 500 from cpanel threw ur post.
    but when i open my post pages its showed 404 error then i googled it and find ur post…thanks…

  33. Bren

    In the event this is a new server, or an Apache upgrade you may have to check the following:

    Open the httpd.conf ie: /etc/httpd/conf/httpd.conf.
    Change the AllowOverride None to AllowOverride All.
    Save changes
    Restart the Apache server.

  34. Mariyam

    Wow, as easy as that, Thank you!

  35. Ashley Adams

    Having a little trouble… After I hit save changes on the permalink page, another 404 error popped up.

  36. Katherine

    This just saved me hundreds of dollars in help. <3

  37. James V

    Quick fix…thanks for the help!

  38. marco

    still having problems, not sure what to do, i followed steps above, and get same results. my web host company uses windows 2012 server so no .htaccess file. so many of these help posts refer to .htaccess which windows does not use. they use the web.config file i think, is that correct? please help

  39. marco

    I have followed the above steps, but still does not work. I am on windows 2012 R12 server and do not have a .htaccess file, even while in FTP force hidden files to display . are there instructions on how to fix this problem when on windows server

    • WPBeginner Support

      Hey Marco,

      First you need to download a backup of your existing web.config file to your computer. After that you need to edit the file on your server and add following rule to the system.webServer element:

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration>
      <system.webServer>
      <rewrite>
      <rules>
      <rule name="WordPress Rule" stopProcessing="true">
      <match url=".*" />
      <conditions>
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php" />
      </rule>
      </rules>
      </rewrite>
      </system.webServer>
      </configuration>
      

      Admin

      • Salami

        Hi WPBeginner Support. I have tried all the solutions pasted on this blog to solve the same problem(404 error on wordpress) am confronting now since two days, but i haven’t got it right. Am developing my website with windows platform using wordpress. Please what other thing I should do to solve this problem?
        Thanks in anticipation to your response.

  40. Dale

    Amazing help thank you! As simple as clicking save!

  41. david c

    worked like a charm – thank you thank you!

  42. Tom

    Many thanks,

    Worked a treat!

  43. Michelle

    I want to hug you for all your extremely helpful posts. Thank you very much!!!

  44. Steve Andrews

    I migrated a site to, imported the mySQL DB and uploaded the entire file structure of the wordpress directory.

    I still got a 404 error for everything but the home page, and re-saving the config in the permalinks section did not work.

    What worked for me was renaming the htaccess file on the FTP site to htaccessOLD so it would not be referenced, but I still have it backed up if needed, then I went and saved the permalink options, had to chose what type of link I wanted (IE date, page no or description). Once I saved all the pages were back up and running.

    Thanks for the post, it gave me the pointers to find this and fix it.

  45. Rene

    I followed the exact steps but unfortunately they don’t work for me. I keep getting errors 404 despite saving my permalink info, removing .htaccess and re-generating it. I am able to view my home page, but as soon as I want to visit a sub page, the error 404 pops up. I also tried switching to WPs default themes, also that doesn’t help. Are there any advices for “advanced” bug solving in case of 404 errors?

    • WPBeginner Support

      Hey Rene,

      Try updating WordPress URLs by visiting the Settings > General page. Make sure that your site and WordPress URL are the same.

      Admin

  46. sampurna

    Hey. I have a little problem with 404. I had changed the permalink of a single post. now for a certain keyword google is displaying the same post in two different positions with same title but different url and one has 404 error. please help.

      • Rene

        Not needed, problem is fixed. I coincidentally found out that my host is reading a different .htaccess file than the one that WP generates. So a “sync” had to be done via their webhosting portal, that was all. Now it works, thanks a lot anyway and perhaps this alternative solution is still useful for other to know that may have a similar setup by their host. Rgds!

        • Carey

          Same here! Needed to ‘sync’ the htaccess file through the webhosting settings page somewhere… thanks for the tip!

  47. Rajinder S. Gill

    This was quick. Thank you :-)

  48. Lois

    You saved my life today. I was at the verge of crying because after creating a post, I was unable to read the post. it returned 404 error. I eearched several websites for answers but your post was well explicit and once I changed the permalink structure, it worked. Thank you thank you.

  49. Kaylee

    I’m still now following at where you exactly change the permissions at. Could you please explain?

    • Mike lavie

      The solution: Login to your server using FTP, and modify the 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 777. Then repeat the original solution.
      Go to Settings » Permalinks, and simply click on Save Changes button.
      Don’t forget to change the permissions back to 755 ( /wp-content/ and /wp-includes/ ).
      I do it for is perfect now!

  50. Lukas

    Great, that help a lot!

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.