How to Fix WordPress Posts Returning 404 Errors
Looking to learn how to fix WordPress posts returning 404 errors? Well, you have come to the right place.
404 error means, the page the user is looking for is no longer there. If you have removed certain pages intentionally and haven't redirected pages to the right URL, then it will show a 404 error. Changing the URL of a certain page can also trigger a 404 error.
There may also be times when your website is under maintenance, and your visitors will be automatically directed to a 404 error page.
The WordPress 404 error commonly occurs when:
- You’ve newly migrated your site to a new host.
- You have changed your URL’s permalink structure and haven’t redirected the old URL.
- You don’t have file permissions.
- You have opened an incorrect URL.
- Poorly coded plugin/theme.
If you're facing a 404 error, don't worry—there are several methods to troubleshoot and resolve it.
Today we are going to talk about 4 methods that you can use to fix WordPress posts returning 404 errors. But first, we will start with-
How WordPress Posts Returning 404 Error Can Affect Your Website
Your WordPress sites returning 404 errors can have severe effects on your website and business. Whether you are running a blog site or a business, both can take a hit if your site returns this error.
These impacts include-
- Ruining User Experience: Imagine when a user visits a certain page on your website only to find a 404 error, how does that user perceive your website? Negatively right? Yes, having a 404 error on your WordPress website will ruin the user experience. Users have an attention span of 8.25 seconds, less than a goldfish. In that time, if you can't make them learn about your website, then you will lose out on business.
- Risking Penalization by Google: When Google sees that your site has a high bounce rate or 404 errors, then it will understand that your site is not well-optimized, risking penalization. Also, you will lose your place in the SERP rankings as well.
- Blocking Page Indexing: A 404 error blocks the pages of a website from indexing. Because pages with this issue are ignored by Google and other search engines.
- Leading to Traffic and Resource Loss: As we said, having a 404 error on your website means, the page you or your users are looking for is not available. This means users will not come to your website, Google will ignore your site and you will lose your place in the Search engine rankings. ultimately losing your traffic and resources.
When you have a website, it is important to address them quickly. Especially an error like 404. Otherwise, slowly but surely you will lose your users.
Now, let's see the methods to fix this issue.
How to Fix WordPress Posts Returning 404 Error: 4 Easy Methods
As we've experienced 404 errors ourselves, we know how to tackle and fix this issue when it occurs. Usually, Google Search Console provides this report. However, it is good practice to check for 404 errors regularly.
We have used these 4 methods to fix WordPress posts returning 404 errors-
- Method 1: Check for Plugin or Theme Conflicts and Custom Code Issues
- Method 2: Fix Your Permalink Settings
- Method 3: Update the WordPress .htaccess File
- Method 4: Contact Your Hosting Provider
Now, let's see how to apply these methods-
Method 1: Check for Plugin or Theme Conflicts and Custom Code Issues
First and foremost, you need to check if you have any plugin or theme conflicts and if you have made any errors while putting in any custom codes.
These can interfere with permalinks and cause a 404 error. Plugin conflicts can happen when you install the same type of plugin. For example, if you install both Dokan Multivendor and WCFM, they will show a conflict.
One way to solve the plugin conflict is to deactivate the plugins one by one. Plugins can sometimes disrupt how WordPress handles links.
You need to check by activating the plugin one by one to see if any of the plugin triggers a 404 error on your website. If the issue reappears after activating one of the plugins, then it is the plugin that is causing the problem.
If the plugin is not important then you can ditch that plugin. Otherwise, you need to contact the developer or support team to solve the issue.
The same goes for your WordPress themes as well. You need to install another theme from Appearance–> Themes like Twenty-Twenty-Four to see if the 404 error is gone.
If it is gone, then your site has a potential conflict with your theme. You need to contact the theme developer or their support to solve the issue.
If you have inserted any custom codes into your website, then you need to check that as well. If you have used a plugin like WPCode, then there is a rare chance that you have any errors in the custom code. Because it will show any error in the code and will automatically deactivate the custom code.
Method 2: Fix Your Permalink Settings
The next method is to 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.
Just go to Settings–> Permalinks, 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. This precaution allows you to easily restore the original file if something goes wrong.
Use an FTP client like FileZilla or the File Manager in your WordPress hosting dashboard to locate the .htaccess file and download a copy to your local machine.
Next, connect to your server using your FTP client or File Manager and log in. Navigate to the root directory of your WordPress installation, where you’ll find folders such as wp-content
and wp-includes
.
Locate the .htaccess file in this directory. If it’s not immediately visible, ensure your FTP client is set to show hidden files.
Once you have found the .htaccess file, you need to make it writable. Right-click on the file and select ‘File permissions' or ‘Change Permissions'. Enter 666
in the ‘Numeric value' box and change the permission.
Then click ‘OK'. This change allows you to edit the file.
Open the .htaccess file with a text editor. Many FTP clients provide a built-in text editor, or you can download the file and use a local text editor like Notepad++ or VS Code. Insert the necessary code into the file. For instance, you might add the following:
apacheCopy code# BEGIN Custom Rules
<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 Custom Rules
After editing, save the changes and re-upload the file to the server if you edited it locally. Verify that your site functions correctly with the new .htaccess rules.
Finally, for security reasons, revert the file permissions of the .htaccess file to 660
. Right-click on the .htaccess file again, select ‘File permissions', enter 660
in the ‘Numeric value' box, and click ‘OK'. This step secures your .htaccess file against unauthorized changes.
Method 4: Contact Your Hosting Provider
Unfortunately, if none of the above methods works and you still have 404 errors on your website, then you need to contact your hosting provider. There may be an error on their end and they will help you fix it.
Hopefully, then you won't have the 404 error on your website.
Other than these methods, you can also try these methods to fix the 404 error as well-
- Clear the Browsing Cache and Cookies
- Set Up a 301 Redirect
- Change and Update the WordPress URL in the Database.
Hopefully, after reading the guide, you won't have to face any 404 errors on your website.
Variations of the 404 Not Found Error
Error messages for the 404 error can vary across different browsers. Here are some different phrases you might encounter:
- “Page Not Found”
- “404 Not Found”
- “The page cannot be found”
- “HTTP Error 404”
- “We can’t find the page you’re looking for.”
- “Error 404”
- “The requested URL was not found on this server.”
- “The requested URL /~ was not found on this server. That’s all we know.”
Last Words
Hopefully, this guide will answer all your questions on how to fix WordPress posts returning 404 errors.
Maintaining a WordPress site can be a hassle if you don't which issues to give priority to. 404 error is one of the most crucial issues that you should give special attention to.
Otherwise, you know the effects and impact it can have on your website.
Is your WordPress site down and not loading? 😱 Don't panic! Learn essential troubleshooting steps to get your website back online ASAP. Check out our blog: How to Solve WordPress Website Not Loading Issues.
If you have any questions regarding fixing the 404 issue, then you should leave a comment in the comment box.