The pages are 404 as trampolines on your WordPress blog : The visiteurs who land on it bounce. How you manage your 404 pages will determine how visiteurs will bounce (it is possible that they completely miss their rebound).

404 errors are not unique to WordPress. The 404 message is the standard error code returned by a web server when a requested web page cannot be located. Basically, a 404 error means the server is working fine, but the requested webpage could not be found.

This tutorial will help you learn more about 404 errors. I will explain to you:

  • How 404 errors occur,
  • How WordPress handles 404 errors,
  • How themes should design an 404 error system, and
  • What you need to do to make sure that the visitor who lands on an 404 error has a better chance of staying on your site without bouncing.

Why 404 errors occur?

Since 404 errors are not unique to WordPress sites (They occur independently of the application, whether with Joomla or Drupal), it is true that this is more recurrent with WordPress. Since WordPress simplifies the adaptation of page URLs and allows you to modify permalink structure to achieve certain SEO goals, this often leads to many 404 errors.

If you have a website with published posts and you change the structure of your permalinks, every link to any of your posts and pages will be incorrect. Let's say you accidentally post a page with the URL http://www.votredomaine.com/nos-produit. Three weeks later, because misspelled, you decide to correct the URL.

Well, was it easy? Absolutely not. You just broke the link of this article you used in your other articles / pages.

So what should you do? Put up with misspelled url? I know you can't do this. Read on to find out more.

How WordPress handles 404 errors

Whenever WordPress finds that a specific page or post does not exist, the basic WordPress controls look for two main files: 404.php and index.php. If WordPress finds the 404.php file, it displays this template. If no 404.php file is available, WordPress will load the index.php file by default.

Most themes use an 404.php template. You can find the 404 template for your theme by visiting " wp-content / themes / Of the active theme and find the 404.php file. When it comes to dealing with 404 errors, this is the first thing WordPress starts by checking.

In most cases, the 404 page offers a template that indicates the error while prompting the user to perform another search. But yet there is so much more you can do with your 404 page, but before you begin designing you need to think about your strategy.

What is your 404 page strategy?

Before you start creating redirects or building a page to better retain your visiteurs, you need to take a minute to think about your strategy. When it comes to 404 pages, you have three things to consider:

  • Where do these errors come from? Can you find and correct links that send visitors to these dead ends?
  • What should you do with your 404 page to reduce bounce?
  • If you know the URL that some visitors used to get a 404 error, which correct URL should you redirect them to?

Your best strategy is to find ways to answer these three questions. First, find the broken internal links and fix them. Then create a 404 page that encourages visitors to stay and helps them find what they're looking for. Third, identify which URLs are repeat offenders to generate 404 errors and redirect visitors to the correct URL.

Let's look at these problems one at a time and determine how we can fix them.

What to do to find broken links

There are two different paths that visitors can take to access an 404 error on your site:

  • Following an internal link between the pages and articles on your site.
  • Following an external link from another website to a page on your website.

Here are 3 tools that you can use to check broken links on your website.

1- Google Search Console

google-search-console tool for wordpress

Download

Google Search Console, if you don't already know it, is a free suite of Google products used to monitor the information Google manages to get from your website. One of the things Google reports on is all the broken links found while crawling. Google offers a journal in which you can access the report on the various broken links. Look for the menu " Crawl errors> crawl Â»(Crawl> Crawl Errors) on the left side menu.

Read this tutorial to learn more.

2- W3C Link Checker

Download

It is a free link check tool of W3C and Mozilla. Enter a URL to check the contents of the returned document for broken links. You can even check related documents if you wish. However, recursive control can end up taking a lot of time and generating a stack of overwhelming results.

3- Broken Link Checker

broken-link-checker WordPress plugin

Download

This free plugin on the directory of WordPress plugins constantly monitors your site for broken links and allows you to be informed at any time of the presence of broken links. One of the best features of the plugin is that you can fix broken links right from the plugin. With over 400 active installs, it is by far the most popular tool for finding broken links.

How to build a better page 404

Unless you are redirecting 404 errors permanently (and you should not do), it is impossible to completely eliminate 404 errors. Even Google is okay with this.

The best thing to do is create a great 404 page. 404 pages are an opportunity to show some personality while helping your visitor find what they are looking for. The best 404 pages often use self-deprecation, humor, and play on the content of the site.

Take a minute and think about what you want to accomplish with your 404 page and how you can communicate that goal in a fun way.

WordPress Codex: a tool to consider

The classic method for crafting a large 404 page is to modify the 404.php file included in your theme, or by creating one if your theme does not use it. The WordPress Codex includes a very good tutorial that will show you how to do that. But this only concerns developers.

404page the plugin to simplify your life

404page WordPress plugin

Download

The 404page plugin is one of the most popular 404 page plugins in the directory of WordPress plugins, and for good reason. First of all, it doesn't create a redirect that can hide important structural issues. Second, it doesn't require additional HTTP requests, which can affect loading speed.

With 404page you will create a new page, design it the way you want it, then adjust the plugin settings to set that page as your 404 error page.

How to Redirect Frequent 404 Errors to Similar Content

Earlier in this tutorial, I brought up a "fictitious" situation involving a misspelled URL which could result in broken links and visitors landing on 404 pages. In this "fictitious" scenario the right thing to do would permanently redirect the old misspelled URL to the corrected URL. This has two advantages:

Visitors who land at the old URL will access the same content with its corrected Url.

The search engines interpret the permanent redirect correctly and index the new URL instead of the old one.

Some plugins to help you there

Redirection

Redirect redirect wordpress plugin

Download

When it comes to creating and managing redirects, there aren't many that Redirection can't do. It is a free plugin, available on the directory WordPress plugins, and active on more than 500.000 websites.

Redirection automatically reports, every time a visitor lands on a 404 page, an error so that you can easily identify URLs that consistently generate 404 errors in order to create permanent 301 redirects. This redirection can even be automatic when a article changes the URL to allow you to transition to the new location.

Redirect 404 to Parent

redirect-404-to-Parent WordPress plugin redirection

Download

This plugin implements a new approach to the issue of 404 errors. The way this plugin works is that all URLs that generate a 404 error code are redirected to the parent URL. This is a bit difficult to understand, and an example will help you.

After installing the plugin, you need to create basic redirection URLs like this: http://www.votresite.com/page_parente/ . After setting up this page, any 404 error generated that contained this base URL will be redirected to the parent URL.

So if anyone tried to go to " http://www.youdomain.com/page_parent/article-numero-one Â»It will be redirected if there is a 404 error to: http://www.yourdomain.com/parent_page/Which is the parent.

That's all for this tutorial, I hope you'll be able to solve the 3 fundamental questions when dealing with 404 errors. Do not hesitate to ask us questions.