Before we talk about finding and fixing your site’s 404 errors, let’s cover exactly what they are and how they occur.
What is a 404 error?
Every webpage returns a status code that tells browsers the page’s state. A page that loads successfully, like this one, returns a 200 code.
When someone arrives at a URL where there is no page, the server returns a 404 code. When someone arrives at a URL that returns a 404 error, WordPress will show a page that looks something like this:
Sometimes 404 pages need to be fixed, and sometimes they do not.
404s you need to fix
Let’s say you have a recipe for chicken noodle soup at this URL:
cookingblog.com/chicken-noodle-soup-recipeee/
A month later, you realize there are three “e’s” in the URL, so you edit it to the following:
cookingblog.com/chicken-noodle-soup-recipe/
The problem, however, is that you already linked to the old URL from numerous other blog posts. Now when anyone clicks one of those links, they’re taken to the old URL, which no longer exists, so they see a 404 error instead of the recipe.
This is a bad experience for the user and something you’ll definitely want to correct.
404s you don’t need to fix
You will occasionally find 404 page views that aren’t due to a mistake of your own.
These are usually due to people manually typing in URLs incorrectly or hackers trying to find some sort of exploit on your site. These views will stand out from the valid ones as the URL will often be strange.
Additionally, most of these 404s will only have one view, so you know they’re not frequently affecting your visitors.
Now that you have an idea of what 404 errors are and which ones need to be addressed let’s talk about how to find them with Independent Analytics.
How to find your 404 errors.
As you may know, Independent Analytics records the Page Type of every page in the data table.
While a 404 error is technically the absence of a page, we give these pages a new Page Type of 404. These error pages show up alongside your other pages in the data table.
If you want to see only your 404 pages, you can do so by adding a filter, like this:
In the filter modal, select Page Type as the column and set the value to 404, then click the Apply button.
The dashboard will update right away to display only your 404 error pages. The Quick Stats and graph will update for these views as well.
You can then go through your 404s and fix any that need addressing.
How to fix 404 errors
When you find a 404 error that needs fixing, there are two ways to address it.
Update internal links to the new address
Going back to my recipe example from before, you could fix the error by visiting every post that links to the old URL and updating the link to the new URL.
Did you know? If you update a post’s URL (permalink), the new URL will be used automatically on your main blog page and all other archives (category pages, tags, search results, etc.).
This process is a bit tedious, but works perfectly fine. However, this only works for links on your site that you have the ability to edit. If other sites link to your old URL, you’ll need to use a 301 redirect.
Add a 301 redirect
Using my example from before, let’s say another food blog linked to your recipe when the URL still had the three “e’s” in it.
You could ask them to edit the link, but they may not respond. Plus, there could be other sites linking to the old URL that you don’t even know about.
The simplest and fastest solution is to implement a 301 redirect.
A 301 redirect will point the old URL to the new URL, so when someone lands on the old URL, they get immediately redirected to the new one. It happens so fast (~50ms), they won’t even notice.
There are lots of plugins that can help you create 301 redirects, and your web host may have this feature as well. Here’s a straightforward tutorial on adding 301 redirects to WordPress that uses a free plugin.
How to add a 301 redirect to WordPress
In practice, it’s a good idea to add a 301 redirect as a safety net whenever you edit a page’s URL.
Now that you know how to identify and fix 404 errors, you can make a habit of checking this report every month and correcting any outstanding errors.