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

    Hello, I have a problem since I migrate the website from localhost to a server, the main page looks good but the menu is not displayed but the links do not work always throws error 404.
    They can help me, this is a cause of a migration from a local server.

  3. Marissa says

    I can’t thank you enough for such a simple tutorial!! Everything else I found made it seem so difficult. I recently switched from http to https and it has been one problem after another..

  4. Rick says

    I didn’t have an .htaccess file so I created one with the info you provided above; then uploaded it and the site works perfectly again. Thanks!

  5. Curtis says

    Hi I have done all the above and noticed the bit of text to copy and paste was already in there! It still is not working and im stressing out!

    • Tibi says

      I’ve done the same thing and nothing changed, the home page still not found :(

      Please contact me if you find a solution

  6. Patrick says

    Wow. This really saved my bacon. Thank you so much for the tip on simply saving the permalinks page. Incredible advice! :)

  7. Alexis says

    hello! i’ve reset permalinks many times to deal with the 404 error. this time when i hit save a file downloaded to my computer: options-permalink.php and the site broke. just got a white screen and each time a file downloaded. finally i got the default permalinks to work but this is not a great solution. does this sound familiar to you? tech support didn’t think it was the .htaccess file but i’m not convinces. moved site from one host to another. any help would be much appreciated.

  8. Mike Birdsall says

    How do I update settings if I can’t log into the WP admin. I get the 404 error when going to /wp-admin

  9. seun says

    Hello, please help, i seem not getting solution through this tutorial cos i can’
    t access my dashboard, i keep getting this message any site directory i open.

    Not Found

    The requested URL /index.php was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

  10. Clint says

    Thank you, just clicking save on my permalink page (which has been customised for years) worked immediately.

  11. Jason says

    Hi, I was having the 404 error problem. Homepage works fine, all other links have the 404 error. Tried the method you suggested in wordpress settings permalinks and click save changes but it didn’t work for me.

    Saw some post earlier about sync the htaccess file through the webhosting settings page somewhere but don’t really know how to do it. Any advice? Thanks

  12. Mohamad Zidani says

    Hi

    I was using Fv Top Level Cats, when i removed still redirection worked from

    example.com/category/tech to

    example.com/tech.

    i try your solution and it doesn’t work.

  13. Michael says

    If this error is affecting your login page, go to .htaccess and remove:

    “deny from all”
    “allow from 00.00.00.00”

  14. Matt Kay says

    Fantastic – I had moved my site from one server to another and started getting worried about 404 errors. The fix worked perfectly – so easy!

  15. Bienvenido says

    A very simple answer to a hair pulling issue. Thanks a bunch. BTW this issue started after I installed BJ Lazy Loading.

  16. Ahmed says

    Hi, One of my site was hacked. There was few hundreds article inserted. Now those has been removed. Google webmaster console showing those as 404.

    How this can affect my site how to fix this?
    Thanks

  17. David M. Curtis says

    Thank you for posting this article. I had spent months building a store / blog and today none of my pages or posts were working other than the front home page, all other links were taking me to a 404 error page. I was about to start completely over – re-peat months of work. This article saved my site. Now everything is working again. I can’t thank you enough.

    • Robin says

      Hi there, completely stuck here, not a computer guy at all so it’s all greek to me. my homepage is good but I’ve created another 5 pages such as blog post, services, etc. and every time I try to view the page I’ve just created I get NOT FOUND The requested URL /services/ was not found on this server.” I’ve tried saving changes didn’t make any difference and I have no idea what an FTP is. Any help ? thx

  18. Preet Karan says

    Hi everyone,

    i installed yoastseo plugin. i generated the XML site successfully, but when i tested it on google search console it is showing 404 error.

    i tried the method listed in article but the problem still persist.
    also i need to mention that in the CCpanel there are two files of the same name htaaccess and htaaccess.1 (with the same code written that has been mentioned by article above ); is it normal,
    can you help me wth the issue

  19. jorge says

    hello there im I would really appreciate help I followed the instructions on saving changes on permalinks not a computer person so do not know how to do the other after is showing me this

    Fatal error: Class ‘Epsilon_Editor_Custom_Control’ not found

  20. yugal joshi says

    great man..thank you much.. i open my site but its throwing 502 error then 503 error and then lastly 500 error..then i solve the problem of 500 from cpanel threw ur post.
    but when i open my post pages its showed 404 error then i googled it and find ur post…thanks…

  21. Bren says

    In the event this is a new server, or an Apache upgrade you may have to check the following:

    Open the httpd.conf ie: /etc/httpd/conf/httpd.conf.
    Change the AllowOverride None to AllowOverride All.
    Save changes
    Restart the Apache server.

  22. Ashley Adams says

    Having a little trouble… After I hit save changes on the permalink page, another 404 error popped up.

  23. marco says

    still having problems, not sure what to do, i followed steps above, and get same results. my web host company uses windows 2012 server so no .htaccess file. so many of these help posts refer to .htaccess which windows does not use. they use the web.config file i think, is that correct? please help

  24. marco says

    I have followed the above steps, but still does not work. I am on windows 2012 R12 server and do not have a .htaccess file, even while in FTP force hidden files to display . are there instructions on how to fix this problem when on windows server

    • WPBeginner Support says

      Hey Marco,

      First you need to download a backup of your existing web.config file to your computer. After that you need to edit the file on your server and add following rule to the system.webServer element:

      <?xml version="1.0" encoding="UTF-8"?>
      <configuration>
      <system.webServer>
      <rewrite>
      <rules>
      <rule name="WordPress Rule" stopProcessing="true">
      <match url=".*" />
      <conditions>
      <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
      <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
      </conditions>
      <action type="Rewrite" url="index.php" />
      </rule>
      </rules>
      </rewrite>
      </system.webServer>
      </configuration>
      

      Admin

      • Salami says

        Hi WPBeginner Support. I have tried all the solutions pasted on this blog to solve the same problem(404 error on wordpress) am confronting now since two days, but i haven’t got it right. Am developing my website with windows platform using wordpress. Please what other thing I should do to solve this problem?
        Thanks in anticipation to your response.

  25. Steve Andrews says

    I migrated a site to, imported the mySQL DB and uploaded the entire file structure of the wordpress directory.

    I still got a 404 error for everything but the home page, and re-saving the config in the permalinks section did not work.

    What worked for me was renaming the htaccess file on the FTP site to htaccessOLD so it would not be referenced, but I still have it backed up if needed, then I went and saved the permalink options, had to chose what type of link I wanted (IE date, page no or description). Once I saved all the pages were back up and running.

    Thanks for the post, it gave me the pointers to find this and fix it.

  26. Rene says

    I followed the exact steps but unfortunately they don’t work for me. I keep getting errors 404 despite saving my permalink info, removing .htaccess and re-generating it. I am able to view my home page, but as soon as I want to visit a sub page, the error 404 pops up. I also tried switching to WPs default themes, also that doesn’t help. Are there any advices for “advanced” bug solving in case of 404 errors?

  27. sampurna says

    Hey. I have a little problem with 404. I had changed the permalink of a single post. now for a certain keyword google is displaying the same post in two different positions with same title but different url and one has 404 error. please help.

      • Rene says

        Not needed, problem is fixed. I coincidentally found out that my host is reading a different .htaccess file than the one that WP generates. So a “sync” had to be done via their webhosting portal, that was all. Now it works, thanks a lot anyway and perhaps this alternative solution is still useful for other to know that may have a similar setup by their host. Rgds!

        • Carey says

          Same here! Needed to ‘sync’ the htaccess file through the webhosting settings page somewhere… thanks for the tip!

  28. Lois says

    You saved my life today. I was at the verge of crying because after creating a post, I was unable to read the post. it returned 404 error. I eearched several websites for answers but your post was well explicit and once I changed the permalink structure, it worked. Thank you thank you.

  29. Kaylee says

    I’m still now following at where you exactly change the permissions at. Could you please explain?

    • Mike lavie says

      The solution: Login to your server using FTP, and modify the folders like /wp-content/ and /wp-includes/ are located. The easiest thing you can do is to temporarily make the file writeable by changing the permissions to 777. Then repeat the original solution.
      Go to Settings » Permalinks, and simply click on Save Changes button.
      Don’t forget to change the permissions back to 755 ( /wp-content/ and /wp-includes/ ).
      I do it for is perfect now!

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.