404 is an HTTP error code we get from the server when the content we are trying to load is missing. 404 Not Found error is a client-side error, meaning that the page was either deleted or moved to a new address without redirecting the old one.
So what’s the problem? The problem with 404 errors in WordPress is that because a 404 template provided by the theme is used to display the page, you are running unnecessary PHP code and MySQL queries.
When a visitor requests a page that no longer exists, he gets served with a 404 page instead that includes widgets, archived pages, links, a search form, etc.
This might look nice and professional from the visitors’ point of view, but from our point as a website owner, it’s only wasting server resources.
You might be losing visitors because of the 404 pages! Think about it:
You see, you are not just but also your websites’ SEO.
So how do you check if your website has any 404 pages? Well, there are 4 ways to check for 404 error pages in WordPress:
The easiest way to check your website for 404 errors is to use some free tools such as:
As a big SEO enthusiast, I can’t highlight enough how important the Google Search Console is for your website.
Before I talk about the WordPress plugins that are used to monitor 404 pages on your website, I have to first say that this sort of plugins may slow down your site and waste resources.
With that said, let us get to the plugins that are used to monitor 404 errors:
Redirection is the most popular redirect manager for WordPress. With it you can easily manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This can help reduce errors and improve your site ranking.
Redirection plugin will keep track of all 404 errors that occur on your site, allowing you to track down and fix problems.
Errors can be grouped to show where you should focus your attention, and can be redirected in bulk.
If you already use the MonsterInsights plugin, it’ll automatically tag your 404 pages for you. So then, if you go into your Google Analytics account and go to Behavior → Site Content → Content Drilldown and search for 404.html
you’ll see something like this:
Once installed, the plugin will begin parsing your posts, bookmarks (AKA blogroll) and other content and looking for links. Depending on the size of your site this can take from a few minutes up to an hour or more. When parsing is complete, the plugin will start checking each link to see if it works. Again, how long this takes depends on how big your site is and how many links there are. You can monitor the progress and tweak various link checking options in Settings -> Link Checker.
This method is only or advanced users and it’s just basically checking the page in browser tools for errors.
This is another method for more tech-savvy users and it’s basically checking the logs from the Apache server.
For a full guide on how to enable the Apache logging check this great article by Loggly.
TIP: Don’t run WordPress for missing static files
Generating custom 404 pages for static files such as images, CSS, JS, etc. is simply a bad idea! As I said at the beginning of this article, this will only drain your server resources and can end up costing you quite a few bucks.
But wait, then why does WordPress do it in the first place?
WordPress does this via .htaccess file for Security purposes – to disable directory sniffing.
Okay so how do we disable it? Glad you asked:
Add the following lines to the .htaccess file before, # BEGIN WordPress:
We now need to create a simple HTML page for the 404 error. This can be added in the hosting control panel, or via the .htaccess file.
Create a .htaccess file, add the following to the top of the file
ErrorDocument 404 /404.html
Then create a simple 404.html page with 404 error not found message and upload to the root of your WordPress install.
I’ve tried to cover most things in this guide hopefully, the above will help you fix any 404 errors on your WordPress site.