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. Jen says

    So for me… I first deleted the WP Fastest Cache out of my Cpanel and THEN…I “bulk deactivated” all my plugins. Did a refresh…and it worked! Praise God!
    Then I activated the plugins I still needed. So far so good.
    Thanks so much!

  3. nebiyu amde says

    i have fixed it using the first method. but when i try to get back to my home page from other pages it’s showing me this error: Error establishing a database connection…how can i fix this

  4. Zeke Yoder says

    If the problem still persists, you might want to check to see if mod_security is active and causing issues.

    I ran into this on a wordpress site hosted by Dreamhost and tried all of the options listed on this page before realizing this was my issue.

    • WPBeginner Support says

      If the methods in this article are not working then you would want to reach out to your hosting provider to see if the error could be caused on that end.

      Admin

  5. Bunmi says

    Thank you.
    I have tried deactivating my plugins; I am using theme twenty sixteen. But still, my pages keep loading “the page can’t be found” when I use the custom permalink. I have done the .htaccess, but nothing is working. The post and categories load fine, but pages won’t load unless I use the plain permalink, which is not advisable for SEO purposes.
    Please help me.

    • WPBeginner Support says

      You may want to check with your hosting provider if you haven’t done so already to see if it could be part of an error on their end.

      Admin

  6. Louis says

    This did not work. .htaccess file is correct but nothing above helped. Still looking for a solution.

  7. miguel says

    hello, thanks for the post, great.
    i have 404 error but cannot acces neither the site or the wordpress. how can you access wordpress admin to solve the problem??

  8. Theodora says

    Please i cannot even access the admin area of my page,i also can’t load the page itself at all. What can i do to solve this?

  9. Shahnawaz Ahmad says

    When i am doing same thing and when i am clicking on Save Changes it also redirecting me to my website with 404 Error

    • WPBeginner Support says

      You may want to reach out to your hosting provider to see if they are seeing any errors for your site on their end.

      Admin

  10. Victor Carlvin says

    Came here at first, couldn’t see the solution in the post. Searched the internet for several hours, came back and decided to read the comment section, there I saw the solution to the issue.

    A plugin caused it and once I deactivate, update and reactive it, works fine thereafter. Thank you

    • WPBeginner Support says

      Thank you for letting us know what solved the issue for you in case anyone else runs into the problem :)

      Admin

  11. ahmed s says

    thanks.. i was very close to pulling my hair out. lol.. i was getting the 404 on all my portfolio pages. yikes. easy fix.

  12. Derin says

    I have tried to click the save button on setting>permalink on my wordpress admin but the problem still persists. I can’t seem to locate the .htaccess on my FTP login. I noticed someone commented about editing the front. I tried checking out the storefront editor, but because I am not a programmer, I am being careful not to cause more damage to the theme. Any help on how to resolve the “404 Page Not Found” permalink problem. It started after a recent wordpress update.

  13. Babajide Adepoju says

    a plugin was the problem for me; I deactivated it and had to edit the page somehow. It wasn’t that nice but it worked.

  14. Charles D says

    Just have to smile, as I am not the only delighted person. Saved from 3 days of agony :-) kept getting a broken link mydomain.com/’/menu/category

    the /’/ was apparently not linking and your TIP on Go to Settings » Permalinks, and simply click on Save Changes button. worked like a charm cheers

    • WPBeginner Support says

      You may want to reach out to your hosting provider to ensure there are no issues on the hosting’s end

      Admin

  15. godfrey says

    After trying everything stated to solve error 404 and couldn’t I decide to edit with front editor and save, vola it started working again.

  16. Qadir Amin says

    I have applied all tricks like
    Changed Permalinks
    Changed Theme
    Changed plugins

    but all in vain, how can i resolve my this error?

    • WPBeginner Support says

      If you recreated the htaccess file you may want to reach out to your hosting provider to ensure there are no errors on the host’s end

      Admin

  17. Dave says

    The 404 error has been haunting me for last 3 days now, my problem is that I cannot access anything, no WP dashboard, no website, no cPanel, it’s turning out to be quite a disaster please help me fix this

    • WPBeginner Support says

      For a 404 on everything, you would want to start by reaching out to your hosting provider for what they see on their end.

      Admin

    • WPBeginner Support says

      Unless I hear otherwise, we do not have a maintenance service but you can feel free to send us the issue you are running into using our contact form.

      Admin

      • Reddemma says

        i moved my local wordpress website to server.i changed composts table pointing to server ip and replaced all local host.changed config file and comoptions table also.
        But menu links not working in server site.How can i fix this?

  18. Rephin Perez says

    Thanks so much !! You have saved my day. Didnt know that Saving the permanent links would fix this issue. :)

  19. Decode Digital Market says

    This post literally saved my life. I just had 404 error to all my posts.

    All I had to do was save changes in permalinks and it worked.

  20. Carmen says

    Thank you so much for the information, unfortunately I am still having issues. When I try to click into +Add New Page it takes me to a 404, if I click +Add New Plugin it also takes me to a 404, if I try to add anything new it will take me to a 404, my website is still in the creation process, it is not yet published. I tried to use filezilla, but after multiple attempts doesn’t connect to my file. Do you know what I should do, I would greatly appreciate your answer!

  21. alaa mohamed says

    ok so am not sure if that’s the exact same issue am having. generally, when I access my website I don’t get any 404 errors yet on my SEO audit tool it is shown that my WordPress posts preview page is coming back with a 404 error, can anyone help me get this fixed ??

    • WPBeginner Support says

      You would want to reach out to the support for your SEO tool to see if this is a known issue with the tool

      Admin

  22. Mathukutty P V says

    Today enabled minify script/styles in swift performance lite and after that except home page all other links showed 404 error. searched and found this post and on checking found .htaccess empty, added the basic code from this post and 404 error gone. All links are working fine Thanks.

  23. jeremy says

    please help me out
    i dont know whats wrong with my WordPress website, i tried creating a new post when am done, i click on publish but it redirect me to a page not found which 404, please help me out as at now, i cant publish anything on my site nothing is working,
    thanks for your help in advance.

  24. Ahmad WABBI says

    This is a great post. I had a problem with the permalinks when I moved my WP site from a server to another. Your post saved me a lot of time searching for the reason.

    Thanks

  25. Babar Waheed says

    hi
    your all articles are easy to understand step by step with screen shots guide thanks for writing

    I have a free classified website in word press. advertisers are posting ads in my website but few of them not meet with our terms and conditions so we delete those ads when i delete ads i get a message by word press.
    (You just trashed a Post. Search engines and other websites can still send traffic to your deleted post. You should create a redirect to ensure your visitors do not get a 404 error when they click on the no longer working URL. With Yoast SEO Premium, you can easily create such redirects)

    My question is how to fix this problem without buying yoast seo premium?

  26. Priya says

    Hello,
    My website is under construction right now.
    But I still receive 404 error while logging in.
    It does not allow me to open my account on wordpress as error arrives immediately after clicking on the log in button.

    How to solve this problem so that I can assess wp to complete my website?

    Plz give me directions so that I can proceed further as soon as possible.

    Thank you!

  27. Baba nee says

    Good day, i installed a pluggin. So i can put the google addsense script to my the head section of my blog, after putting this code to the pluggin and updating my permalinks i saved it. It still telling me page not found! How do i fix the error! Is there any other way i can insert this script manually via my cpanel! Please help a brother who is so confused right now

  28. Sapna says

    These steps seem so simple. But I tried everything. Changing the rights to 666 and 664. Deleting the .htaccess file. Copying and pasting the code didn’t help either.

    I even changed the permalink settings to which I desire and rewrite all the pages by hand again. To make sure they get the name I want and to have new page id’s

    I tried literally everything. I’m really clueless now. Can you please help me.

  29. Dasuni says

    Fatal error: Class ‘Email_Before_Download_Form’ not found in /wp-content/plugins/email-before-download/includes/class-email-before-download-shortcode.php on line 65

    Why???

  30. Darshan Tejani says

    Hi. I liked the simplicity in the Tutorial. Sadly, it didn’t work for me!

    The error goes away only If I change my permalink to ‘plain’. If I change back permalink to ‘post name’, then it shows the error! I’d be grateful If you’d help me out here. Thanks anyway for the post.

    • WPBeginner Support says

      If recreating the htaccess method is not working then you would want to reach out to your hosting provider to see if the mod_rewrite rule is enabled on their server.

      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.