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

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

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

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:

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]
# 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/ 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

773 CommentsLeave a Reply

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Larry says


    I have moved my two domains from a web hosting service provider to another web hosting service provider. The new web hosting service provider setup WordPress websites from the cPanel. Only the homepages are loading correctly but the other webpage links are showing Server Error 404 Page Not Found.

    The webhosting service provider told me to update my permalinks and the web.config code. I updated the permalinks to show “post name”. I don’t know how to update the web.config code. From watching these videos, I see that I should update the htaccess file. However, my htaccess do not show any missing text and it contains identical as shown in your video. What next should I do?

    Many thanks.

  3. Joe says

    My problem is, I moved my blog to a self host. And changed my permalink to “post name” Ever since then,

    1. I noticed my traffic start reducing,

    2. Couldn’t get searches from Google/yahoo/bing linking to my blog again.

    3. Got a lot of broken links.

    What do I do please?

    I’ve started getting discouraged with this..

  4. prakhar says

    when i try to see plugins it gives 404 error.
    add plugin is working fine but i can’t get to plugin.php when i try to see
    installed plugins.
    also update-core.php also gives 404 error.
    what could be the reason?

  5. jeff says

    I have the same problem. I couldnt able to install a plugin which is this “” .i always get file not found error 404 as result. can anyone help me out please? thanks guys in advance

  6. Sjoerd says


    I have the same problem. The first solution worked for me, just now wordpress somehow keeps getting back tot the 404.
    So i click save changes, it works again. And then a few minutes later the 404 error is back. Anyone any ideas?


    Kind regards,

  7. Ravi J says

    I have the same issue too….

    1) Changed Permalink
    2) Manullay created the .htaccess file
    3) removed and created the site once again

    Amy help is greatly appriciated

    Note: I am setting up a local instance in Ubuntu 16 LTS.

  8. Biggles says

    I have a similar problem: I moved hosting providers and now my WP login box is top left hand corner of my browser screen and, most critically, when I login, every page and link for WP gives me a 404.

    The website loads fine for my visitors but I am unable to gain access myself in WP. Well, I am, I can log in, but that’s all I am able to do. After many years of web design, this is a first.

    I have done the following:
    1. deleted the .htaccess file
    2. tried an old .htaccess file
    3. created a new .htaccess file
    4. changed the name of some and all of the plugin folder names via ftp to see if there’s an issue with a plugin

    FYI, that I was unable to load my sample website (subdomain) after the migration, and all that was showing was a ‘database error’ white screen. I finally managed to track down the issue, and I was a little bit upset about it: in my new cPanel, I noticed the username had disappeared next to the database name, and when I tried re-entering it again it wouldn’t take it because I had been limited to only a few characters in length. I created a new username and updated the config file, and it works okay now.

    So, I opened my new cPanel and my previous cPanel side by side and my old host didn’t restrict me on database username character length, whereas my new host did to about 7 or 8.

    …so, I’m starting to think that even though all of my other subdomains and client websites are now all loading fine, that it may be that a different version of cPanel and how my new hosting provider has set it up has affected how I interact in WP for my failing website.

    v. 68.0.23 new cPanel
    v. 66.0.34 old cPanel

    Do you think there is an issue with how my new host has setup WHM and / or cPanel.

    Many thanks in advance : )

    • Afroze says

      for me, after going nuts, i had to enable the rewrite module… i forgot to do this when I migrated sites.

      in ubuntu:
      sudo a2enmod rewrite

  9. Fahad Siddiqui says

    I tried this .htaccess code but the error remains same as “Not Found
    The requested document was not found on this server.”

  10. TJ says

    I am wondering if this would fix my admin login page? Keeps showing 404 error and not the login page. I don’t have issues with a 404 error on pages and post. I think it might be conflicting plugin I’m using called Hide MyWp, but they told me its working and reset the settings anway and said it’s beyond their plugin control.

  11. LaVonne Carlson says

    Thank you! This worked for me. I did have to change the Common Settings from “Custom Structure” to “Post name”, but once I did that my blog came back.

  12. Nick says

    I followed your instructions, but I still get the “white page of death” with my posts. Is there a way to actually remove “index.php”?

    • WPBeginner Support says

      Hi Nick,

      The index.php file is crucial for your WordPress site to work properly. If you think it is causing the issue, then you can download a fresh copy of WordPress, unzip on your computer, locate the index.php file and upload it to your website replacing the old file.


  13. Rafi ullah says

    Hi every one..
    i have a website which is working properly but when i login to admin panel and want to edit a page it show me a error that “page not found” but in the front end it look fine this error show only on editing time ..
    please help me i am stuck
    Thanks in advance

  14. Jeremy says

    THANK YOU SO MUCH! I’ve tried everything else thinking it was a timing error. You saved me lots of time.

    Thank you again!

  15. Serguei Kireev says

    didn’t work for me. installed Yoast SEO, noticed it defaulted to weird permalinks with /index.php/ in them, went to change that to normal way – no more permalinks for me… only works via ?p=123

  16. Karen Holst says

    You guys are the best!

    I always find your tutorials to be just what I need to update/fix my WordPress site!

    Regarding the 404 not found issues, I had some template pages (I purchased a WordPress theme from a vendor and had some live pages hidden that I wasn’t using) that were getting indexed that I didn’t want indexed. So I changed the pages to “unpublished” in WordPress.

    I ran an analysis on indexability and now all those pages are showing “404 Not Found” errors.

    Do you all suggest a way to keep these pages from being indexed altogether? What is the best practice for fixing something like this?

    Thank you again for all the great work you all do!

  17. vishnu says

    please help to fix the following.
    while submitting a comment in my webpage its working properly but after 3 or more submission it showing 404 page not found
    how can i fix this problem without using a plugin.

  18. Munesh Dagar says

    this is very helpful.. my website is not not load page cause of URL not found
    i am go to permalinks & select other links & again i selected postname & save settings my website is work properly

  19. danny says

    I had the problem with the permalinks and fixed the issue by saving as a plain permalink then saving as custom permalink. that worked but I am having a problem with the permalinks issue again. i fixed it by doing the above step again. is there a way to avoid it happening again. thanks!

  20. Milos Mitrovic says

    Hello guys,
    I have the same problem, some pages appear as ‘not found’ but they are present in wordpress. Check this one:
    I have updated permalinks but it didn’t work.
    I wouldn’t dare accessing my FTP and would like to know if there is any other way to change it? I use hosted wordpress.

  21. Jheel says

    I am getting error for rest of my pages , excluding the home page. The images & the videos are not visible. I have done all the required steps. Kindly help me out.

  22. Hemant Pandey says

    It helped. Very nice. Can you suggest best permalink structure? Also how to get social counts back after changing permalink structure?

  23. Himaja says

    I am trying to add the wordpress blog as a subdirectory in nginx server. Added blog under cakephp/app/webroot/blog . Main page works fine but not the post links and sublinks. Shows not found error. I tried your post but no result. Can you please help me to sort out this?


  24. Mike says

    Hello, I tried just about everything
    1. Deleted and uploaded new htaccess file
    2. Checked robots.txt
    3. Checked sitemap
    4. Disabled all plugins
    5. Checked google console
    6. Checked to see if my site is blacklisted
    Google will not communicate with my site all at.
    I only get “403 forbidden error”. I couldn’t even verify my site ownership with google until I verified through the “cname card”.
    During 1 test I did get a “200 server error”. Please help

  25. Jill says

    Hello! I downloaded the htaccess file and copy/pasted. I am still getting the 404 errors on my blog. Not sure what else to try. Any ideas?
    Thank you,

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.