The other day, while I was checking my Twitter feed, having my coffee (what, don't you do that?), a tweet from a friend caught my attention.
This friend strongly recommended reading an article that looked really interesting. I was happy to read it quietly before starting my work day… except that by following the link, all I found instead of this great article was a blank page with an error message: “404, page not found”.
You can imagine how disappointed I was.
How frustrating to find an error message or a blank page when browsing the Internet, don't you think?
I am sure that you too, in your life as an Internet user, have already encountered, and more than once, the path of a 404 error. It often takes the form of the message “404 not found” or “page not found”.
These errors are a real plague for the Internet user, but also for us who create or manage WordPress sites.
The good news is that there are solutions to correct them! And since we love giving you a hand, we've put together a complete guide to learn how to fix a WordPress 404 error.
To begin, here are the points covered in this article:
Table of contents
What is a 404 error?
404 is simply the HTTP code returned by the server when you try to access a web page that no longer exists. Error 404 is an Internet classic: it has given rise to a number of the same and delightful animated gifs.
Note: If you want to know more about WordPress errors, check out our extensive guide to WordPress errors (and how to fix them).
Often, 404 errors occur when you click on a link to a page that has been deleted, renamed, or moved. The URL is therefore no longer valid.
404 errors are common after a site redesign – because old pages may no longer exist, but are still indexed on search engines or other sites.
They will also appear if you change the slug of a post, as this will change the permalink (URL).
This will also be the case if you change the permalink structure on your site: for example, if your article URLs look like mysite.com/category/title-of-my-article and you want to replace them with mysite.com/title-of-my-article.
Finally, 404 errors frequently occur due to simple input errors: if a user types mysite.com/blob instead of mysite.com/blog, BOOM! Error 404!
As I'm sure you've understood, 404 errors are an integral part of Internet life, and can hardly be avoided.
The issue for site managers is that 404 errors have a negative impact:
- On your users' experience: nothing is more frustrating than clicking on a link and landing on an error message!
- On your SEO: when search engine robots browse the links to your site, they will detect each of these 404 errors. If a site generates many errors of this type, its ranking will go down, especially if there are backlinks referring to a page not found.
To learn more about the impact of 404 errors on your SEO, you can watch this video from Matt Cutts, a very influential expert in the world of SEO.
How to detect 404 errors on your WordPress site
How do you know if your WordPress site is a victim of these bloody 404 errors? Here are several complementary methods.
1 – With Google Search Console
You can use the Google Search Console to view the pages that Google cannot find on your site.
Google Search Console is a very useful tool that allows you to monitor, among other things, your site's ranking in Google's index and the errors that occur.
In your Search Console, go to the “Coverage” report, and click on the “Excluded” tab. In the list below the graph, click on the “Unlocatable (404)” line to access the details of the unlocatable pages detected by Google.
You will be able to see all the pages of your site that are known to Google but are not found. In the example above, there's some work to do!
2 – With the Broken Link Checker plugin
The Broken Link Checker plugin will scan your site and detect broken links. Useful when you have many pages or articles and internal links.
After installing this plugin, go to the Tools > Broken Links page.
You will immediately see if your site contains links to pages or images that cannot be found, whether the're links to your own site or to third-party sites.
Afterwards, the plugin will scan your site regularly, and notify you as soon as a link to a page not found is detected!
Beware of this plugin – it's quite resource-intensive. If you notice slowdowns on your site, disable it once you have completed your 404 error tracking.
3 – With the Redirection plugin
We'll talk about it later, but the Redirection plugin is your number one ally in the fight against any WordPress 404 error.
This plugin allows you to keep a history of all the 404 errors encountered on your site, by “real” users, but also (and especially!) by robots that scan your site regularly (including Google robots).
If you have just installed it, no history will be found yet. But if you check the Tools > Redirection page after 24 hours, you will probably see errors in the “404” tab.
For each error, the list displays the following elements: the detection date, the URL not found that causes the error, information about the person or robot that detected the error (in the example below, it's robots).
This tool is therefore very useful to detect all the pages that cannot be found on your WordPress site.
Warning: many errors listed by Redirection are not “real” 404 errors, and therefore do not need to be fixed. For example, if robots are willing to access protected files of your theme or installed plugins (even if they don't exist), it will appear here in the list. So it's up to you to sort them out.
You may be wondering which of these 3 methods you should choose to monitor for 404 errors on your site.
In my opinion, if you were to use only one, it would be Google Search Console.
Why? Because you'll have to use this tool anyway, to monitor the indexing and positioning of your site in the Google index. Google Search Console compiles all the “defects” of your site in one place, including: 404 errors, pages not optimized for mobile devices, pages too slow to load…
But the ideal solution is to combine Google Search Console and the Redirection plugin.
Indeed, it will allow you to know if certain errors are frequently encountered by “real” Internet users. It will thus be able to provide interesting information on the behaviour of the users of your site (typing errors, etc.).
Speed up your website with WP Rocket
How to set up a custom 404 page
Now that you have detected which pages are causing the 404 errors on your site, what should you do?
The first thing any self-respecting website owner needs to do is to create a personalized 404 page, in order to avoid users having to deal with a very ugly error page.
The goal is to keep the user on your site, even if he didn't find the page he initially wanted.
Most WordPress themes allow you to create a custom 404 page (some page builders like Elementor also allow it in pro version). And if you can't do it, you will find many free plugins to do it, like 404page.
Once installed, the 404page plugin will allow you to choose which page of your site will be used as a personalized 404 page.
It also allows you to setup some more technical options, one of which caught my attention in particular: sending an error 410 instead of an error 404 when the page you are looking for is in the trash.
Code 410 indicates that the resource is not temporarily unavailable, but that it has been permanently deleted. Google's robots will understand that they can unindex this page.
When you create your 404 page, feel free to include more personalized content: a nice little message, an animated gif, a search engine, a list of the most frequently visited pages… in short, help the user find the content they are looking for!
To see a concrete example, click on this link and you will discover our magnificent page 404 (we are quite proud of it!)
Fix 404 errors permanently with redirections
Though you now know how to set up a custom 404 page, your work is not yet done.
We will now have to roll up our sleeves and remove these 404 errors for good! For that, you're going to have to set up redirects.
Indeed, the personalized page 404 improves the user experience, but does not solve the problem of referencing on search engines.
Once a web page has been deleted or renamed, Google will continue to try to access it, and the only way to make Google understand that this page no longer exists is to redirect it to a valid page on your site.
For this reason too, we offer several solutions.
1 – With the All 404 Redirect to Homepage plugin
If your website has too many frequent 404 errors, a radical solution is to opt for this simple plugin: All 404 Redirect to Homepage.
It will allow you to automatically redirect all obsolete or incorrect URLs to a page on your site (usually the homepage).
After installing and activating the plugin, go to the extension settings.
It couldn't be easier – only two options are available:
- Enable or disable redirect
- Choose the page to which you will redirect 404 errors (this can be the homepage, or another page of your site)
Save the settings, and you're done!
To test the effectiveness of the plugin, type the URL of your site in your browser followed by a “fake” text, for example: mysite.com/test. Normally, you will be redirected to the page chosen previously.
In which cases can you use this plugin?
This plugin is effective, but does not really admit nuance.
It will be interesting in some cases:
- If your site generates too many 404 errors and you don't have time to create redirects for all obsolete pages.
- If you have completely changed the content of your site (example: change of theme, positioning…), but you want to keep the same domain name.
In these situations, the All 404 Redirect to Homepage plugin will allow you to avoid losing traffic and penalize your site's ranking on search engines.
Of course, if you choose to redirect all 404 errors to your homepage, you don't need to create a custom 404 page anymore.
2 – With the Redirection plugin
Redirecting your 404 errors to your site's homepage is very useful, but it remains a basic solution.
For an Internet user, being “savagely” sent back to the homepage of a site, without explanation, when you thought you were accessing interesting content, is rather disappointing!
If you want to go further and pamper your site visitors, we advise you to set up personalized redirects as much as possible.
Following a redesign of your site, for example, try to redirect obsolete URLs to new pages dealing with the same subject. Your visitors will thank you, and you will minimize the bounce rate, i.e. the proportion of visitors who leave your site on the first page.
To do this, we recommend that you use the Redirection plugin.
As we've seen previously, it allows you to trace the history of 404 errors on your site, but as its name suggests, it is mainly used to set up… redirects.
With this plugin, you will be able to define, for each URL not found, which URL the user should be redirected to.
Setting up a redirect has two consequences:
- People clicking on links to pages that cannot be found will be automatically and openly redirected to valid pages on the site: +1 for the user experience.
- When Google's robots (and others) browse the links to your site, for each redirected page, they'll receive a 301 code (the encrypted code of a redirect). This allows the search engine to know that this page is obsolete, and to remove it from its index, replacing it with the new page: +1 for SEO.
To sum it all up…
As you have learned (I hope so!), it is essential to look at the 404 errors occurring on your site today.
Start by monitoring them, especially with Google Search Console.
If you haven't already done so, get on with creating a custom 404 page.
And most importantly, redirect obsolete URLs to real pages on your site, to improve the user experience and optimize your SEO. For that, the Redirection plugin is your best friend!
Have you often faced the problem of 404 errors?
Do you have any other tips to fix WordPress 404 errors?
Share your experience in the comments below!
Receive the next posts for free and access exclusive resources. More than 35000 people have done it, why not you?