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)

We’ve had moments where everything looked fine in WordPress, but the post link showed a 404 error instead. No changes to the content — just a missing page that should have been there.

This usually pops up after tweaking settings, switching themes, or adding code that silently affects permalinks. It can catch you off guard, especially if the rest of your site is working perfectly.

Whenever we run into unexpected 404 errors, we follow a simple process to get the post URLs back on track — no guesswork, no heavy troubleshooting. And that’s exactly what we’re sharing with you in this guide.

You’ll be able to fix the 404 errors and make sure your posts are loading the way they should.

How to fix WordPress posts returning 404 error

Why Are My WordPress Posts Returning a 404 Error?

There are several reasons why your posts might be showing a 404 “Page Not Found” error in WordPress. 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 or pages.

How to Find All WordPress Posts With 404 Errors

Before we get to the solutions, it’d be good to figure out if this error is just happening to one or two posts or multiple posts. This way, you can determine the scope of the problem and choose the most appropriate solution.

One easy way to figure this out is to use Google Search Console. If you haven’t submitted your site to Google Search Console already, then read our guide on how to add your WordPress site to Google Search Console.

Once the Google bot has crawled and indexed your site, Google Search Console will then provide you with detailed information about your site’s performance, including any 404 errors it encounters.

To find out which posts are returning 404 errors, you can log in to the Search Console dashboard. Then, navigate to the ‘Pages’ report, and you will see a detailed list of all the errors.

Google Search Console Pages Report

For more information, you can read our list of tips for using Google Search Console to grow website traffic, which includes some tips on how to fix 404 errors with the tool.

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:

No time 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!

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

Sometimes, plugins, themes, or custom code you’ve added to your WordPress website 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 do a quick Google 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’ll need to connect to your server using an FTP client like FileZilla or the File Manager in your hosting control panel.

Next, find the .htaccess file in your site’s root folder—this is the same directory that contains folders like /wp-content/ and /wp-includes/.

Right-click on the file and select ‘File permissions’ or ‘Change permissions’ from your FTP client.

.htaccess file permissions

If WordPress couldn’t write to the file before, try changing its permissions temporarily to 666 to make it writable.

After that, go back to your WordPress admin area and resave your permalink settings. This allows WordPress to regenerate a proper .htaccess file.

Once that’s done, make sure to change the file permissions back to a more secure setting: 644. This setting allows WordPress to read the file, while still protecting it from unauthorized changes.

Change file attributes for the .htaccess file to 644

Alternatively, you can manually edit the file.

Simply right-click on the .htacccess file and then select View/Edit option.

Edit .htaccess file

The file will open in plain text editor like Notepad or TextEdit.

Now you need to add the following default WordPress rewrite rules:

# 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: Enable mod-rewrite (Local WordPress Installation)

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, look for lines that say AllowOverride None and change them to AllowOverride All. This tells Apache to allow the use of .htaccess files.

You’ll typically find these inside <Directory> blocks—especially the one pointing to your site’s folder, like htdocs if you’re using XAMPP. If you’re unsure, it’s okay to apply the change wherever you see it inside the file, as long as it’s not a system directory. For local testing, this usually works just fine.

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.

Video Tutorial

If you need visual instructions, then just watch the video below.

Subscribe to WPBeginner

Frequently Asked Questions About WordPress 404 Errors

Encountering 404 errors on your WordPress site can be confusing. Below, we’ve answered common questions that can help you troubleshoot and fix the issue more effectively.

1. Why am I getting a 404 error on my WordPress posts?

This usually means WordPress can’t find the post at the requested URL. It can happen due to broken permalinks, a corrupted .htaccess file, deleted posts, or a plugin/theme conflict that changes how URLs are handled.

2. How do I fix a 404 error in WordPress?

Try resaving your permalink settings by going to Settings » Permalinks and clicking ‘Save Changes’. If that doesn’t work, check your .htaccess file, disable plugins, or switch to a default theme to rule out conflicts.

3. How can I find all 404 errors on my WordPress site?

You can use Google Search Console to see a list of 404 errors Googlebot encounters. Plugins like Broken Link Checker can also help spot broken links and missing pages inside your site.

4. What does the .htaccess file do in WordPress?

The .htaccess file controls how URLs are processed. WordPress uses it to manage permalink structure and route URLs to the correct content. If it’s missing or corrupted, URLs may stop working correctly.

5. How do I safely edit the .htaccess file?

You can edit it using an FTP client or your hosting file manager. Always back it up first. After editing, make sure the permissions are set to 644 so it stays readable and secure.

6. Why do my WordPress category or tag pages show 404 errors?

This can happen if your theme doesn’t support archive templates, or if permalink settings are misconfigured. Resaving permalinks and checking your theme’s archive support can help fix it.

7. How do I fix 404 errors for custom post types?

Visit Settings » Permalinks and click ‘Save Changes’ to refresh rewrite rules. Also, check that your custom post type is registered with the right rewrite settings and has archive support if needed.

8. Can I redirect 404 pages to my homepage or another page?

Yes, plugins like Redirection let you create 301 redirects from old or broken URLs to new ones. You can also create a custom 404 page to guide users back to useful content.

🎁 Bonus: Additional Guide on Handing 404 Errors

You may also find the following resources helpful in managing 404 and other common WordPress errors.

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

773 CommentsLeave a Reply

  1. Laxmi Prasanna

    thank you very much. you saved my day. god bless you

  2. chandan

    you save my day

  3. Alessandro Morotti

    Thxs a lot man.

    Your save my job!!!

    congratulations by your time

  4. Niketa

    Many many Thanks.. I was worried first but your blog fixed my 404…as I was having exactly same issue.

  5. Abhishek Sharma

    Sir i dont know how to thank you.. But today you saved my life.. I was so scared. I just published a post and then when i checked that in my browser it showed 404 error then i check another post and then all . i was surrounded by 404 errors except my homepage was working. Now before posting to wordpress forums i just googled it and found solution on your website.,..
    Mannn Thanks for saving my life.

    • WPBeginner Support

      Hi Abhishek,

      We are glad you found this article helpful. Don’t forget to follow us on Facebook for more WordPress tips and tutorials.

      Admin

  6. Richard

    Hi !
    I doesn’t work for me.
    i added ” . ” for prefix category but i fall in a 404 page when i try to access to my subcategory :s

  7. CR

    Awesome! It helped.

  8. Paola

    I LOVE YOU! I didn’t knew how to fix this I’m a complete novice. Thank you thank you! !

  9. Marlena

    I’m so pleased to have found this article first. I’m a complete novice and I fixed my own 404 issue.
    YAY!
    Thanks so much!

  10. Saud Razzak

    Very informative and useful article for WordPress beginners!

    • Eri

      Please can you help me for this, because I tryied but i cant fix it :/

  11. Tom C

    Great guide! Totally solved my issue.

  12. Anil

    I have created a subdirectory. And I have two wordpress installed, one in root and the other in subdirectory. Both of them contains posts and pages. I want to access both and it’s happening. But when I am hiding the subdirectory slug from the post URL by modifying the .htaccess file, the sub directory name got hidden as per the requirement but the posts of my main domain is inaccessible and getting 404 error. I want to access the post from both root as well as subdirectory. Please suggest.

  13. Jawad

    Thank you very very much for your help

  14. Farukh Hussain

    Thanks alot for sharing. Your tutorials always helps me.

  15. Karen

    Thank you so much for this!

  16. Grant Turner

    Fixed. My problem was since I’m running on a windows server then I don’t have a .htaccess file. I need to create a web.config file.

  17. Cindy Martin

    This fix DID NOT work for me! I still have a 404 error on my blog page only. I am using Gridalicious and have had nothing but trouble! (Not with Gridalicious but other stuff too).
    I removed everything from the to start over. loaded the theme and get the error.

    Blog posts are not showing up on the blog page except in the widget and the main page is the 404 error message. Saving permalinks does nothing at all. Host is GoDaddy. HELP! I’m really tired of all this and frustrated.

  18. Maranna

    Thanks! I moved website from one server to another and had the problem with posts returning 404. Main page and admin were working fine. Re-saving permalinks worked to fix this problem. Seems that this setting is not carried over correctly in all cases.

  19. Aondongu Tivzenda

    The permalinks fix worked perfectly. Thank you for this website. Awesome!

  20. alvin

    My problem is funny. I have a couple of WP websites I am currently running each logged into one browser with different portals and logging user names. After I noticed the 404 error checking the redirect area i see my author names have been mixed up from all the different websites. Can someone please assist

  21. niranjan

    It worked! Thanks!!

  22. Vishwa

    It worked! Thanks!!
    Yours is a great website!

  23. Charley Gordon

    Thanks for sharing your knowledge.

  24. Al

    Thanks, worked for me :-)

  25. Mayapur Voice

    This post saved my day today! In an attempt to fix a long standing problem today our host changed the .htaccess file. The issue got resolved but it broke all my links. By the grace of God, I found this post in an instant and it was exactly what I needed. Thanks tons!

  26. marcela bonadio

    exactly what i needed. thanks for sharing your knowledge.

  27. Casey

    Hello, thanks for this article and all the other awesome articles I have found on wpbeginner. I am running into some problems with my front page giving me an “oops! That page can’t be found” error. I am wondering if you have any advice on how to fix it.

    I am running:
    LAMP with Debian 3.2.84-1 x86_64 (Wheezy) on a VPS, Apache 2.2.22, php5
    Wordpress: 4.7.1
    Theme: YS Magazine

    The original issue occurred when I switched the permalink structure to use “post type” instead of the default. At that point I could no longer view any of my pages and just got a 404 error. So, I did some research and edited my .htaccess file to allow overwrite. This fixed the problem of the 404 errors on all my pages, except on whatever page is set to my home page. To be clear, there was no problem with any of the pages before I changed permalinks. It also does not matter if I set the front page to static or posts. If I change my front page to another page I can then see the page which was set previously as the front page, but the new front page then gives me the error.

    I have tried:
    disabling all my plugins and enabling them one by one
    changing themes
    changing the .htaccess file back
    changing permalink settings

    I have been searching for an answer to this for hours now and seem to have ran into a brick wall. Any help would be super appreciated. Thank you so much.

  28. Bart Dority

    Thank you so much for this post!

    I knew my 404 errors had something to do with the permalink structure – and I even tried changing the permalink structure and saving it – and otherwise updating and refreshing it — but it still wasn’t working. But then I read this post which said — instead of changing the permalink style and saving it, — just leave it where it is, and click Save anyway. That worked for me. A huge relief. Thank you!

  29. Angelica

    Thank you so much!! It worked!!

  30. MarcB

    Thank you so much for this help. Really a lifesaver.

  31. Elyes Gherib

    Thank you very much, this did it for me!

  32. Z

    Thanks for the post. I’ve had to deal with other problems after switching hosting providers, but this was a new one.

    I did the method provided and my site was back to normal within seconds.

  33. Kristine

    Hello, I am hoping you can help me- I am super nervous about my wp site right now. When I type the address into the search engine it is a completely barebones site that says it is “set up through Wix” that no longer looks like our site we have been operating through wordpress. This just happened out of the blue and I am so nervous about our posts.

    • WPBeginner Support

      Hi Kristine,

      It seems like your WordPress site’s domain is hosted by Wix. If you have login details for a wix account, then you can login and point the domain to your current WordPress hosting provider. If you are unsure, then please try contacting Wix support and your WordPress hosting provider support for more help.

      Admin

  34. Jolene

    Thank you! My blog has been down and I couldn’t figure out how to fix. In a last ditch effort before I call customer support…I googled. You saved the day!

  35. Bruno Almond

    Great blog here! Additionally your site rather a lot up very fast! What host are you the usage of? Can I am getting your affiliate link in your host? I desire my web site loaded up as fast as yours lol

  36. AJ

    great job mate, you did a better job than the tech support at bluehost

  37. Lorene

    No, this worked for the one post that was showing Error 404, but then ALL the others that worked before, now show Error 404. So I had to change it back. Hope most of them work now.

  38. Gabe DeFrates

    Excellent tip for fixing the permalink! I was getting the “File not found” error, and I went right into the WP Control Panel Settings, Saved Changes and she’s working again. You saved the day! Thank you for your time in posting this.

  39. Samnang Thorng

    Thanks I can deal with site now. Great helps

  40. jhonny

    Recently I have changed my site permalinks and now i am getting lots of 404 errors i have redirected them some of them to new url and others to homepage but still my site users were going down and down what to do now help me please should i change them back to old permalinks? or something else to do please tell me

  41. Exxagon

    Thanks a lot for your post.
    Since many weeks, I was stucked with a 404 error each time I tried to change my permalinks structure.
    I found the solutions in your post :
    1. Modify /etc/apache2/apache2.conf, and set “AllowOverride All” everywhere instead of ” AllowOverride None”
    2. Empty /var/www/html/.htaccess completely, change it to www-data:www-data & set it temporary to 777.
    3. And the main one : “sudo a2enmod rewrite”, and “service apache2 restart”

    Thanks again !!
    Xavier

    • Asif

      thanks bro it help me and my server version is working fine now

    • Suraj

      Thanks a lot… It’s working for me.

    • Erwin

      Hey, where can I find “/etc/apache2/apache2.conf”??? I don´t even know where to search? Do I need a special Application or something? Sorry, i´ve no idea : I

      • Abel

        Hi, “/etc/apache2/apache2.conf” is a Ubuntu system folder. If you want to access it, you should have access to your server (like ssh).

    • Abel

      Thanks a lot!

  42. Vinita

    Recently I am getting lots of 404 page errors in google webmaster. While revamping my wordpress website, instead of redirecting old urls to new, I just edited existing urls to new ones. e.g. website.com/url1 was edited to website.com/url2. Now webmaster if giving 404 error for old urls i.e. website.com/url1. How am I supposed to solve this error? (there are almost 155 urls with 404 errors so cant ignore)

  43. Sandy

    Is there a plugin that can find 404 errors and redirect them safely with best SEO tactics? Or should i do a edit find and replace in my xml file and remove the urls?

    appreciate your ideas…

  44. Michael

    changing the right to 660 made my site unavailable. i had to set .htaccess to 644 (which was the original setting). regards Michael

  45. Swadesh

    Thanks a lot :)

    Its working for me.

  46. Kieron Atkinson

    I’m running wordpress on a client’s in-house server and even though the htaccess file is there with the rewrite module sequence, permalinks are still not working. In fact all the URLs are coming up as example.com/index.php/permalink.

    How do I check if the module rewrite is enabled on the server? My client says that they have that enabled but it still doesn’t work.

    Many thanks for your help.
    Kieron :)

  47. Renee

    Mahalo nui loa (thank you very much)!
    Reassigning the Permalinks is exactly what was needed after moving 10 sites to a new hosting company.

    Abundant blessings to you and your team.

    • WPBeginner Support

      Hi Renee,

      Glad you found it helpful and thanks for the kind words. You may also want to join us on Twitter for more WordPress tips and tutorials.

      Admin

  48. Steve

    Thank you for your well written article. I have logged in to both /wp-content and /wp-includes/ and I havent found my .htaccess file.
    Is it possible that I dont have one as I also get the 404 error if i try and redirect a page usin Redirection in WP.
    Thanks in advance.
    Steve

  49. Paras

    hello
    i am facing this same problem
    i tried your method but still its showing error

  50. Margarita

    Today I was about to launch my web after 5 months working very hard in localhost. I was very happy but exhausted. While doing all the migration process, my site was gone. I had made a backup of course, but after trying a hundred times nothing worked. All seemed lost… until I found your post and it was solved in less than 30 min.

    My day has been awful, a waste of many hours and energies. But now I go to bed with a smile in my face. Happy again. Infinite thanks.

    Marga Rubio Soto

    • WPBeginner Support

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

      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.