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)

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

What Causes the WordPress Posts Returning 404 Error?

WordPress is a powerful content management system (CMS), but a slight change can sometimes make your WordPress website inaccessible.

In some cases, you may not be able to access your WordPress admin area or the website itself, like with the internal server error or error establishing a database connection.

By contrast, when your WordPress posts are returning 404 errors, you will still be able to get into your admin area and see your WordPress website on the front end. Then, when you click on a blog post, you will see a message saying “404 Not Found”.

Although this error message can be scary, it doesn’t mean you have lost your WordPress posts. Instead, your .htaccess file has probably been deleted, or something went wrong with the rewrite rules on your blog.

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.

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 2: 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 3: 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 4: 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

768 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

    Hi,

    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

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

  6. Sjoerd says

    Hi,

    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?

    Thanks.

    Kind regards,
    Sjoerd

  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.

      Admin

  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

    Hi
    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

    wow,
    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.
    Thanks

  21. Jheel says

    Hey,
    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?

    Thanks.

  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,
    Jill

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.