In our last tutorial, we discussed how you could monitor your website’s 404 errors using Rank Math. In this tutorial, we are going to learn how to fix them.
Start by navigating to the 404 monitor by hovering over Rank Math’s WordPress menu and then clicking 404 Monitor in the submenu.
You’ll reach the 404 Monitor. Once again, we’re starting with a clean slate.
Let’s add a bunch of errors to the mix and then proceed.
If you haven’t noticed, we’re using the advanced 404 Monitor in Rank Math. We’ve briefly discussed the Simple and Advanced monitors in our previous KB. Be sure to check it out. In that tutorial, we also touched upon the importance of the 5 fields of data that Rank Math collects for you.
- Access Time
These 5 fields give you the data to act and resolve 404 errors. All you need to do is to interpret the data and convert it into actionable information.
Making Sense of the data
When you just a few errors, you can go about fixing one at a time without putting much thought into it. But, when your website grows and starts getting hundreds of 404 errors a day, you need a strategy. Here are some potential strategies that can use.
The High Hits
The easiest strategy to tame 404 errors is to start with the error with the maximum number of hits. Since more hits mean more users are trying to access the page, this strategy has a high impact.
To use this strategy, you will have to sort your errors in descending order of hits. To do that, hover over the Hits field. You should see an arrow pointing upwards. Click the Hits field to have the errors arranged in ascending order of Hits. Click the field again to have the order reversed to descending. When the downward facing arrow is visible even without hovering, you can be sure that the order is descending.
Once you have the data sorted, you should check out the referrer column. That is because a large number of hits on a 404 error is likely by a referral. Multiple users won’t make the same typo when trying to access your website. That is why taking a look at the Referrer tab will show you the real cause of the error.
Again, there are 2 possibilities with 2 solutions.
If the referral URI is an internal link, all you have to do is go to the error causing URL and fix it.
However, if the URI is external, then there are a couple of solutions. First, you can contact the website, thank them for giving you a link, and ask them to use the correct URL. If they do, problem solved. But if they don’t then, you’ll have to redirect the error causing URI to the new location. We’ll cover details of it later in this tutorial.
High Number of Different URIs
If you don’t have a high number of hits, but have a long list of different URIs with only a couple of hits each, then this strategy would be perfect. The idea behind this is that such errors happen only for a couple of reasons. Either someone is trying to hack into your website, or a bot is trying to find some data about your website.
To confirm, you can use the rest of the fields to make an educated guess. If all the URIs that you see are not natural, but seemingly random URLs, it’s most likely an attacker trying to get in. You can also refer to the Access Time and User-Agent fields to verify. A lot of requests in quick succession from the same user agent is surely a sign of foul play.
To solve this kind of problem, you can either ignore the issue as real users are not involved, or delete the error, or block the malicious user from your website entirely.
No matter what strategy you choose, the solution will always be 2 things.
- Ignore or delete the 404 error
- Redirect the error causing URL to a new URL
Let’s see how about we go about doing that.
1 – Delete the Error
Since we don’t have to teach you how to ignore the error, the only second option is to delete the error. Deleting the error will remove it from this list and make space for errors to be found. Note that if the error still exits, i.e., a user or a bot is still trying to access the URL with the error, then the 404 error will show up again.
To delete the error, simply bring your mouse over the URI field for the error in question. You’ll see 2 options appear below it.
Click the “Delete” link to delete the 404 error. In a couple of seconds, the error will disappear, indicating that it was deleted.
2 – Redirect the Error
The second option to solve a 404 error is to redirect the URL to another URL with the help of HTTP Redirection. If you don’t know what redirection is, we’ve written helpful guides for explaining what redirection is and also about Rank Math’s redirection tool. We would recommend that you go through them to understand the various options. Here we are going to cover just the basics.
To redirect a URL that causes a 404 error, hover over the entry. You’ll see 2 options appear below it. Click the “Redirect” option.
Rank Math will then take you to the Redirections tool, which would look something like this.
Let’s go through the options quickly.
- Source URL: This will automatically be populated with the error causing URL. You don’t need to change it.
- Match: This field lets you configure if you want to redirect a single URL or multiple URLs that match a specific pattern. Since we’re redirecting only a single URL, we’ll keep it at “Exact”. We’ve covered the other options this setting offers in its dedicated tutorial.
- Destination URL: This is the URL where you want to redirect the error causing URL. Please note that you have to enter the full address here, like,
http://www.mywebsite.com/new-link/and not just part of the URL as you see in the Source URL field. Also, this URL can be a link to another page on your website or even an external link to another website.
- Redirection Type: There are many types of redirection options, but generally for 404 errors, you would choose 301 Permanent Move. We discuss all the available options in the Redirection knowledge base.
- Status: This option lets you enable or disable the redirect. This option is useful in many cases, but for a 404 error, you would simply leave it at Activate.
Now that you’ve understood the settings, it’s time to configure them. If you notice, all you have to enter is the Destination URL, the rest of the fields will be left like it is. Once you do enter the Destination URL, click “Add Redirection” to save.
You’ll see the list of redirections created with your redirection on the top. Similar to the 404 error, you’ll see the “Hits” field here as well, which will represent how many times the redirection was invoked.
We just discussed 2 solutions to solving 404 errors, redirection or -deletion. But, doing any of those one-by-one can be, to say the least. That is why we built Bulk Actions into Rank Math as well. To use Bulk Action, select all the errors that you want to redirect or delete, then click the Bulk Actions drop-down.
Select the action you want to perform, then click the Apply Button. For this example, we’ll delete the errors.
And the errors will be deleted. You’ll also see a confirmation message on the top of the screen.
An important thing to note is that if you choose to bulk redirect the errors, you’ll be able to redirect all the selected errors to a single destination URL only. If you’d like to redirect the errors to different URLs, choose them separately.
The third bulk action is the “Clear Log” option. It’s basically a nuke option which will delete all the 404 errors ever recorded. This option might be useful for testing purposes, but it’s unlikely that you would use it during the normal course of management of your website. Use it only if you know what you’re doing. Once the log is cleared, only the errors that are recorded after the clear will be displayed, and there is no way to get the lost data back. Proceed with caution.