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. Moinuddin Waheed says

    This is one of the most occuring error for wordpress websites.
    this is really frustrating as it seems to get stuck and leading to nowhere.
    I have solved the issue by saving the permalink.
    I didn’t know about the other steps.
    I really appreciate the efforts to make it holistic by including all the steps to resolve this error.

  3. mohadese esmaeeli says

    Hello. The 404 error can be really frustrating, and we’ve all encountered it at least once. The situation becomes challenging when everything appears to be correct, there are no broken links, yet the 404 error persists. I faced this issue once, and it was resolved by adjusting the permalink settings.

  4. amir says

    Hi
    in my case, a plugin named as “WebP Express” create a htaccess file in uploads folder that restrict my access to some images.
    try rename or remove it and see if the problem still exist.

  5. Eriab Nsereko says

    Syed & the team u saved my whole entire day! My homepage was actually loading well.. but the other pages couldn’t load. So, I pasted the code in my .htaccess file and it did absolutely like magic.

    # BEGIN WordPress

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    # END WordPress

  6. David Helleskov Fønsbo says

    Thanks – None of the suggested solutions did work for me. Looks like the typical permalink error but it isn’t.

    Saving permalink again does not create a new .htaccess.

    • WPBeginner Support says

      If none of the methods in our guide are working for you, please reach out to your hosting provider and they should be able to help fix the issue.

      Admin

  7. Frank Thomas says

    Thank you for this post. I was missing the .htaccess files after moving sites and of course the wordpress code in them. I’ve replaced it all and voila! We are live at 5. Thanks.

    • WPBeginner Support says

      If none of the recommendations from our guide could solve your error, please reach out to your hosting provider and they should be able to take a look and help!

      Admin

  8. Harald says

    Hi,
    saving permalink helped me too, but it keeps returning over and over again after some days.
    I have no clue what causes it.

    • WPBeginner Support says

      If it is a constantly recurring error, we would recommend reaching out to your hosting provider and they can either look at their error logs for the site or keep an eye on your site for the specific error causing the problem.

      Admin

  9. Emmanuel says

    This is my lifesaver. My site is working fine after modifying the .htaccess files.
    Thanks a ton!

  10. Jon says

    For me the problem was I forced a redirect from mydomain.com to ww.mydomain.com, but in wordpress the site URL said mydomain.com. After changing the redirection to ww.mydomain.com -> mydomain.com everything worked.

Leave a Reply to Kuldeep Singh Cancel 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.

WPBeginner Assistant
How can I help you?

By chatting, you consent to this chat being stored according to our privacy policy and your email will be added to receive weekly WordPress tutorials from WPBeginner.