How to fix 404 errors in WordPress
The "404 Error" is a HTTP (Hypertext Transfer Protocol) status code that indicates that the requested resource could not be found on the server. In other words, the web server was unable to locate the page, image, or file that the user requested.
This error occurs when a user tries to access a URL that doesn't exist on the server, or when the server is unable to locate the requested resource due to an incorrect URL or broken link. The 404 Error message is displayed as a web page, which typically includes a message indicating that the requested resource could not be found, along with options for the user to take further action, such as returning to the previous page or searching for the requested resource.
It's important to note that the 404 Error is a client-side error, meaning that it occurs on the user's end and not on the server. This is different from server-side errors, such as the 500 Internal Server Error, which indicate that something is wrong with the server and the server is unable to process the request.
Here is a list of some of the common names given to the "404 Error" page:
- Page Not Found
- Error 404
- 404 Error Page
- 404 File Not Found
- File Not Found
- The requested URL was not found on this server
- Resource Not Found
- Page Cannot Be Displayed
- Oops! This Link Appears to Be Broken
- Sorry, the Page You Requested Cannot Be Found
- 404 Not Found
- The Page You Are Looking For Does Not Exist
- This Page Cannot Be Found
- The Page You Requested Was Not Found
- The URL You Requested Could Not Be Found
The main purpose of the 404 Error page is to inform you that the requested page could not be found. In other words, it doesn't exists, or doesn't exist anymore. The page may never have existed, been moved or deleted.
We'll take a look at 13 common causes of 404 error pages in WordPress, and provide you with step-by-step instructions on how to fix each one.
1. Permalink Issues
If you have set up a custom permalink structure for your WordPress site, but it's not set up correctly, it can cause 404 error pages.
To fix this issue, you can see our guide about regenerate WordPress permalinks.
2. Deleted Pages or Posts
If you delete a page or post on your WordPress site, anyone who tries to access it will see a 404 error.
To fix this issue, you can try the following:
- Create a new page or post with the same name as the deleted one.
- Use a plugin like "Redirection" to set up a redirect from the old URL to the new one.
- If the page or post was important, consider restoring it from a backup.
3. Broken Links
Broken links can occur when the URL of a page or resource on your site changes, and someone tries to access the old URL.
To fix this issue, you can try the following:
- Use a plugin like WPS Checker to scan your site for broken links.
- When you find a broken link, update it to the new URL, or set up a redirect from the old URL to the new one.
- Consider regularly checking for broken links on your site to prevent this issue from recurring.
4. Incorrect File or Folder Names
Incorrect file or folder names can result in a 404 error if someone tries to access a resource that does not exist.
To fix this issue, you can try the following:
- Check the names of all the files and folders on your site, and make sure they are correct.
- Update the names of any incorrect files or folders, and update any links that point to them.
5. Incorrect File or Folder Permissions
Incorrect file or folder permissions can cause a wide range of issues with your WordPress site, including 404 error pages.
To fix this issue, you can try the following:
- Log in to your server via FTP or cPanel.
- Find the file or folder that is causing the issue.
- Right-click on the directory and select "File permissions."
- Make sure that the directory permissions are set to 755.
- If the permissions are incorrect, change them to the correct values.
- Repeat the process for each file on your WordPress site and make sure that the file permissions are set to 644.
- Save your changes, and test your site to see if the issue has been resolved.
6. Misconfigured .htaccess File
The .htaccess file on your server can control many aspects of your WordPress site, including how URLs are structured. If it is misconfigured, it can result in a 404 error.
To fix this issue, you can try the following:
- Access the .htaccess file using an FTP client or the file manager in your hosting control panel.
- Download a backup of the file to your computer, in case you need to restore it.
- Edit the file and make any necessary changes, following the guidelines provided by your hosting provider or WordPress documentation.
- Save the file, and then test your site to make sure the issue has been resolved.
If the issue persists, try to replace any current code in the .htaccess file by the following 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
7. Plugin Conflicts
Sometimes, plugins can conflict with each other and result in a 404 error.
To fix this issue, you can try the following:
- Deactivate all plugins on your WordPress site, then reactivate them one by one until you find the one that is causing the conflict.
- If you find the conflicting plugin, either deactivate it permanently or find an alternative that is compatible with the rest of your plugins.
- If you are unable to find the conflicting plugin, consider reinstalling all plugins, or contact the plugin developers for support.
8. Theme Issues
Just like plugins, themes can also cause conflicts that result in a 404 error.
To fix this issue, you can try the following:
- Switch to a default WordPress theme, such as "Twenty Twenty-One."
- Test your site to see if the issue has been resolved.
- If the issue has been resolved, the problem was with your theme. You can either switch to a different theme or contact the theme developer for support.
- If the issue has not been resolved, the problem is with something else on your site.
9. Incorrect URL Input
If someone tries to access a URL on your site that does not exist, they will see a 404 error.
To fix this issue, you can try the following:
- Double-check the URL that the user entered to make sure it is correct.
- If the URL is incorrect, you can provide the user with the correct URL.
- If the URL is correct, the page may have been moved or deleted. In this case, you can either provide the user with a different page on your site, or set up a redirect from the old URL to a new one.
10. Server Issues
In some cases, server issues can result in a 404 error.
To fix this issue, you can try the following:
- Contact your hosting provider for support, and explain the issue you are experiencing.
- If the issue is with the server, your hosting provider should be able to resolve it.
- If the issue is not with the server, your hosting provider should be able to help you determine the cause of the problem.
11. Caching Issues
Caching can cause issues with your WordPress site, including 404 errors.
To fix this issue, you can try the following:
- Clear the cache on your browser, as well as any caching plugins you have installed on your site.
- If the issue persists, try disabling caching on your site temporarily, and then test it again.
- If the issue has been resolved, re-enable caching and make any necessary adjustments to your caching settings.
12. Misconfigured Redirects
If you have set up redirects on your WordPress site, but they are misconfigured, they can cause 404 error pages.
To fix this issue, you can try the following:
- Log in to your WordPress admin area.
- Go to the "Settings" section, and select "Permalinks."
- Check the settings for your redirects, and make sure they are set up correctly.
- If the redirects are incorrect, make any necessary adjustments.
- Save your changes, and test your site to see if the issue has been resolved.
13. Corrupted WordPress Database
In some cases, a corrupted WordPress database can cause 404 error pages. To fix this issue, you can try the following:
Log in to your server via cPanel.
- Go to the "Databases" section, and find the database for your WordPress site.
- Backup your database, in case you need to revert to the original version.
- Repair the database, following the instructions provided by your hosting provider.
- Test your site to see if the issue has been resolved.