Have you ever tried to open one of your WordPress posts only to be greeted by a 404 error? At times, we experience that when we’re working on our own WordPress sites or helping our users
This error occurs when you can access your WordPress admin area and blog, but when you try to open a specific post, you’re met with a “404 Not Found” message.
It can be frustrating to see your content seemingly disappear, but we’ve found some workarounds to fix this issue. In this complete guide, we’ll show you how to fix WordPress posts returning 404 errors.
Why Are My WordPress Posts Returning a 404 Error?
There are several reasons why your posts might be showing a 404 “Page Not Found” error in WordPress. 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 or pages.
How to Find All WordPress Posts With 404 Errors
Before we get to the solutions, it’d be good to figure out if this error is just happening to one or two posts or multiple posts. This way, you can determine the scope of the problem and choose the most appropriate solution.
One easy way to figure this out is to use Google Search Console. If you haven’t submitted your site to Google Search Console already, then read our guide on how to add your WordPress site to Google Search Console.
Once the Google bot has crawled and indexed your site, Google Search Console will then provide you with detailed information about your site’s performance, including any 404 errors it encounters.
To find out which posts are returning 404 errors, you can log in to the Search Console dashboard. Then, navigate to the ‘Pages’ report, and you will see a detailed list of all the errors.
For more information, you can read our list of tips for using Google Search Console to grow website traffic, which includes some tips on how to fix 404 errors with the tool.
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:
No time to fix 404 errors yourself? WPBeginner Pro Services can help! With our affordable Emergency WordPress Support, you can hire experts to fix 404 errors, broken links, redirect issues, and much more. Stop stressing over WordPress issues and get them fixed! Schedule Emergency WordPress Support Services today!
Method 1: Check for Plugin or Theme Conflicts and Custom Code Issues
Sometimes, plugins, themes, or custom code you’ve added to your WordPress website 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 do a quick Google 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.
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.
If none of these solutions work, move on to the next method where we’ll troubleshoot your permalink settings.
Method 2: Fix 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.
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.’
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’.
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.
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 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: Enable mod-rewrite (Local WordPress Installation)
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).’
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.
Then, find all instances of AllowOverride None
and change them to AllowOverride All
.
The ‘All’ value means that all directives can be overridden.
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.
Video Tutorial
If you need visual instructions, then just watch the video below.
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.
Larry
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.
Joe
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..
WPBeginner Support
Hi Joe,
You can change your permalink structure to whatever it was before by visiting Settings » Permalinks page.
Admin
David
Thank you very much! This tutorial was very helpful.
Bert Ramirez
Worked like charm…THANK YOU!!
Tejash
Thanks so much. I was able to resolve the error
prakhar
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?
jeff
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
Marisol
Hey thank you work for me took me 2 minutes to fix it!
Sjoerd
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
Ravi J
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.
Biggles
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 : )
Wen
Hi there, i did other test and the error show everytime, so any ideas??
Afroze
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
Wen
Hi guys!
I’ve tried everything and its shows still the error in my links, can you help me?
WPBeginner Support
Hi Wen,
If you are seeing 404 errors on just few pages, then you can try setting up redirects to fix them.
Admin
Wen
The problem is in all the links except the home…. and i did everything except redirect…
Hank Wilson
Thanks for this, permalinks idea worked. Bookmarked for future reference
Alan Ross
Thanks for the fix. Worked like a charm !
Fahad Siddiqui
I tried this .htaccess code but the error remains same as “Not Found
The requested document was not found on this server.”
TJ
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.
WPBeginner Support
Hi TJ,
Try steps mentioned in our WordPress troubleshooting guide. It will help you figure out what’s causing the issue and how to fix it.
Admin
LaVonne Carlson
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.
Nick
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
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
Malik aadil
Thanks so much
It helped me to solve 404 error problem
srinivas
i dont know how to thank you…it really helps and solved my problem…thanks ….lovely post
Demari
Thank you so much for this!
Christina
Thank you very much! Your help solved the problem!
Rafi ullah
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
Jeremy
THANK YOU SO MUCH! I’ve tried everything else thinking it was a timing error. You saved me lots of time.
Thank you again!
Serguei Kireev
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
mudi
Hi, you guys are great it’s work for me
elham
Thank you so much!!!!
Vikash
Thanks, Its worked perfectly.
Karen Holst
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!
WPBeginner Support
Hi Karen,
You can set up redirects for those pages. See our guide on how to setup redirects in WordPress.
Admin
Shahidul Islam
Thanks So much! It works great!
Azizul Haque
Thanks, This worked for me too!
Mark Quinn
Many thanks. This worked a treat.
vishnu
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.
Munesh Dagar
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
zhivko
The update in Settings Permalink worked perfectly for me.
danny
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!
Milos Mitrovic
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
WPBeginner Support
Hi Milos,
We will suggest that you update .htaccess file using FTP or File Manager in cPanel.
Admin
Jheel
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.
jora
same probleme did you find any solution yet ? Thank you
Kimberly
Thank you so much!! Flushing the rewrite rules worked.
Hemant Pandey
It helped. Very nice. Can you suggest best permalink structure? Also how to get social counts back after changing permalink structure?
Himaja
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.
Mike
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
Lucky
Many thanks for you help. It worked my site is back.
Jill
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
Dias, Wesley S.
THANKS!!!!! Very much.
sam
where is .htaccess?
Phoks
not work same probleme halp me please
tauseef shah
thank you so much buddy, it really help me
robert
worked. thanks.