How to fix 404 errors on a site
404 errors can be really frustrating, both for your site visitors and for you as the owner. They indicate that a requested page cannot be found, which can harm user experience and SEO. Fortunately, there are several ways to fix these errors on WordPress.
In this article, I reveal to you all the secrets of correcting these errors in order to improve your SEO. If you are concerned about the health of your site, check out this practical guide to auditing a website.
Table of contents
What is a 404 error?
A 404 error is a bit like arriving at a house that no longer exists. Imagine that you have the address of a friend, you go to his house, but instead of his house, you only find a vacant lot. Frustrating, right?
In the world of the web, this is exactly what happens. When you click on a link or type an address into your browser, you expect to land on a specific web page. But sometimes that page has disappeared, been moved, or never existed. This is where the famous 404 error message appears. Basically, this is the web server's polite way of telling you: “Oops, sorry, I can't find what you're looking for“. It's as if the internet's GPS is a little lost.
Ces erreurs peuvent survenir pour plein de raisons : un lien mal tapé, une page supprimée sans redirection, ou même un site qui a complètement déménagé. C’est agaçant pour les visiteurs, et ça peut aussi être problématique pour le référencement d’un site. Bref, une erreur 404, c’est le petit couac du web qui nous rappelle que même dans le monde virtuel, parfois, on peut se perdre !
Impacts of 404 errors on SEO
404 errors and SEO are a bit like a pebble in the shoe for website owners. You might think it's not a big deal, but in reality, it can really set you back in the race to rank well on Google.
Imagine for a moment that Google is a mystery shopper who regularly visits your online store. Every time he comes across a 404 error, it's like he finds an empty shelf where he expected to see a product. Not very professional, is it? These errors can have several negative effects on your SEO. First, they waste what is called the “crawl budget”. Basically, Google has a limited time to crawl your site. If he spends this precious time coming across pages that don't exist, that's so much valuable content that he won't be able to index.
Next, 404 errors can hurt the user experience. If visitors click on links that take them nowhere, they may leave your site more quickly. This high bounce rate is a negative signal to Google, which could conclude that your site is not relevant or of good quality. There is also the issue of “link juice“. If you have external links that point to 404 pages on your site, it's like you're letting tap water run without getting it back. All that beautiful link juice gets lost instead of benefiting your SEO.
That said, don't panic! A few 404 errors won't ruin your site overnight. Google understands that it's okay to have a few. The important thing is to manage them intelligently: set up redirects, fix broken links, and make sure your 404 page is useful and guides visitors to relevant content.
How to detect 404 errors
Ah, the tools to detect 404 pages! It's a bit like having a metal detector to find hidden treasures – except here, you're looking for lost pages. Here are some of the best tools you can use to ferret out those 404 errors lurking on your site:
Google Search Console
Google Search Console (GSC), formerly known as Google Webmaster Tools, is a free tool provided by Google that is absolutely essential for any SEO-conscious website owner. When it comes to detecting 404 errors, GSC is like a doctor who regularly examines your site for any anomalies.
To start using GSC, you must first verify that you are the site owner. This is usually done by adding a small piece of code to your site or uploading a specific file. Once this step is completed, GSC begins collecting data from your site.
In the section "COVER” from GSC, you will find a detailed report on your site's errors, including 404 errors. This report is actually a gold mine of information. Not only does it tell you which pages are returning a 404 error, but it also tells you how Google discovered those pages. Was it by following an internal link on your site? Or maybe via an external link? This information is crucial to understanding the origin of the problem and resolving it effectively.
Un des grands avantages de GSC est qu’il vous montre l’évolution des erreurs dans le temps. Vous pouvez ainsi voir si le problème est récent ou s’il traîne depuis un moment. De plus, lorsque vous corrigez une erreur, vous pouvez demander à Google de revérifier la page directement depuis l’interface de GSC. C’est comme si vous disiez à Google : “Hé, j’ai réparé ça, tu peux revenir vérifier !"
But GSC doesn't just show you 404 errors. It also gives you valuable information about the keywords for which your site appears in search results, external links pointing to your site, and even speed loading of your mobile pages. It’s a real dashboard for the SEO health of your site.
Another interesting aspect of GSC is that it alerts you when there is a major problem. If your site suddenly accumulates a large number of 404 errors, you will probably receive an email informing you. It’s like having a guard watching over your site 24/7. However, GSC has its limitations. It doesn’t scan your site in real time and the data can sometimes be a few days behind. Additionally, it only detects pages that Google has tried to crawl, which means that some 404 errors could go unnoticed if they concern pages that Google hasn’t discovered yet.
Broken Link Checker
Broken Link Checker is an online tool simple but effective to detect broken links and 404 errors on your website. It’s like having a virtual assistant that meticulously scours every corner of your site for those little annoyances that can harm user experience and SEO. Using Broken Link Checker is amazingly simple. All you have to do is go to their website, enter your site URL in the field provided, and run the scan. It’s a bit like letting a sniffer dog loose in your yard to find truffles, except here, the truffles are problematic links.
Once the analysis is started, Broken Link Checker will go through your site page by page, link by link. This may take some time, especially if your site is large. During this time, you can go about your business, have a coffee, or why not, start thinking about how you are going to correct the errors he will find.
The report generated by Broken Link Checker is very comprehensive. It not only shows you URLs that return a 404 error, but also broken links pointing to other sites. This is particularly useful because broken external links can also hurt your credibility in the eyes of Google.
For each problematic link, the tool tells you the page where it is located and the anchor text used. It's as if your assistant said to you: “Look, on this page, this link with this text doesn't work”. This information is valuable for correcting problems quickly and efficiently.
One of the great advantages of Broken Link Checker is that it is able to detect different types of errors, not just 404s. It can spot 500 errors (server errors), chain redirects, or even links that take too long to load. It’s like having a private investigator investigating all the malfunctions on your site. The tool also offers a recurring audit feature. You can schedule regular scans of your site, for example once a week or once a month. It’s a bit like having a gardener come and weed your site regularly.
However, Broken Link Checker has its limitations. For very large sites, the analysis can be long and sometimes incomplete. Additionally, the tool only checks publicly accessible links, so if you have password-protected pages, they will not be scanned.
Article to read: Imagify: optimize your images on WordPress
Ahrefs
Ahrefs is like the Swiss Army knife of SEO, and when it comes to detecting 404 errors, it’s a real goldsmith. Think of it as a high-tech private investigator that not only finds your lost pages, but also tells you who’s looking for them and why. At the heart of Ahrefs is a powerful crawler that scans billions of web pages on a regular basis. When you give it your site, it’ll comb through it, spotting every broken link and 404 error with surgical precision. It’s like having a medical scanner for your website.
The tool “Website Audit” from Ahrefs is particularly useful for detecting 404 errors. It doesn't just list them, it categorizes them and gives you insight into their impact on the overall health of your site. It's like having a detailed medical report, with charts and everything.
But where Ahrefs really stands out is in its ability to show you external links that point to your 404 pages. These are called “lost backlinks“. Imagine you wrote a great article that was widely shared, but you accidentally deleted it. Ahrefs will show you all the sites that still link to this missing page. It's like finding a treasure you thought was lost forever!
This feature is particularly valuable for SEO. These lost backlinks represent wasted link juice, authority that you could regain by redirecting these 404 pages to relevant content. It’s a bit like Ahrefs giving you an SEO treasure map.
Ahrefs goes one step further by showing you the potential traffic you’re losing because of these 404 errors. It estimates how many visitors you could have had if these pages still existed. It’s like the tool is saying, “Hey, you dropped that bag of money, want to get it back?” Another powerful aspect of Ahrefs is its ability to monitor your competitors’ 404 errors. You can identify opportunities where your competitors have lost valuable content and perhaps create similar content to capture that traffic. It’s like SEO recycling!
However, all this power comes at a price, literally. Ahrefs is a paid tool, and not the cheapest. It’s a significant investment, especially for small businesses or beginner bloggers. It’s a bit like buying a Ferrari to go grocery shopping in: it’s super effective, but can be a bit overkill if you don’t really need it. Plus, Ahrefs can be a bit intimidating for beginners. Its interface is rich with data and features, which can be overwhelming if you’re not familiar with technical SEO. It’s a bit like trying to fly a jetliner when you’re just learning to drive.
How to fix 404 errors?
Fixing 404 errors is a bit like playing web plumber. Here's how you can plug these digital leaks:
Identify the cause
Identifying the cause of 404 errors is like conducting a police investigation on your website. It is the first crucial step to effectively solving the problem. Start by examine URLs which generate 404 errors. Are they similar? Is there a recurring pattern? Sometimes a simple typo in an internal link can be the source of many errors. Other times it's a more systemic change, like a change to your site structure or a migration gone wrong.
Use tools like Google Search Console or site crawlers to get a complete list of 404 errors. Analyze each case: is this a page that existed before and was removed? Or maybe a malformed URL due to a faulty plugin?
Don't forget to also check backlinks. Sometimes 404 errors come from third-party sites that link to pages that don't exist on your site. In this case, you don't have direct control over the link, but you can take steps to mitigate the problem.
Also examine the history of your site. Have you made any major changes recently? A CMS update, theme change, or installation of a new plugin can sometimes cause unexpected 404 errors. If you manage an e-commerce site, check if the errors concern products. It is common for products out of stock or removed from the catalog to generate 404s if their management is not correctly configured.
Set up 301 redirects
301 redirects are like your website’s GPS system. They guide visitors and search engines to the right destination when a page has moved or disappeared. This is a crucial technique for maintaining your site’s SEO and user experience. A 301 redirect is a permanent instruction that essentially says, “This page is no longer here, go here instead.” It transfers the majority of the “SEO juice” from the old page to the new one, which is vital for preserving your search engine rankings.
To set up 301 redirects, you have several options depending on your technical configuration. If you use WordPress, plugins like Redirection or Yoast SEO make the task much easier. You can simply enter the old URL and the new one, and the plugin takes care of the rest.
For Apache server sites, you can use the file .htaccess. A line of code like “Redirect 301 /old-page.html /new-page.html" will do. It's more technical, but also more flexible and efficient for large sites. On Nginx, you will need to modify the server configuration file. It's a little more complex, but it offers complete control over your redirects.
Lorsque vous mettez en place des redirections, pensez à la structure logique. Si vous avez supprimé une page de produit, redirigez vers une catégorie similaire plutôt que vers la page d’accueil. C’est comme si un magasin fermait : vous préféreriez être dirigé vers un magasin similaire plutôt que vers le centre-ville, is not it ? Attention aux redirections en chaîne (A vers B vers C) qui peuvent ralentir votre site. Visez toujours la destination finale directement.
301 redirects are a powerful tool in your SEO arsenal. Used judiciously, they can save your SEO during major changes to your site, while ensuring smooth navigation for your visitors. It's a small technical effort that can have a major impact on the health of your website.
Fix internal links
Correct the internal links, it's like doing a big spring cleaning in your digital home. It’s a meticulous but essential process for maintaining the health and effectiveness of your website. Start by performing a complete audit of your internal links. Tools like Screaming Frog or Google Search Console's Internal Links Report can help you get the big picture. It's like mapping all the paths in your site.
Once you have your list of broken links, prioritize them. Focus on first the most important pages : your home pages, categories, and your most popular articles. It's a bit like repairing the main roads first before taking care of the smaller paths.
For each broken link, you have several options. If the target page still exists but has moved, simply update the link with the new URL. If the page no longer exists, you can either remove the link or replace it with a link to a similar page. Think about relevance to your visitors: a dead link is a dead end, but a link to irrelevant content is almost as bad.
Also check your navigation menus, sidebars, and footers. These elements often contain links to important pages and are present throughout your site. A mistake here can have a major impact. If you use WordPress, plugins like Broken Link Checker can automate part of this process. They can regularly scan your site and alert you of new broken links. It's like having a maintenance worker constantly checking the condition of your house.
Also remember to check your text anchors. Make sure they are descriptive and relevant. “Click here” is not as useful as “Complete Guide to Fixing 404 Errors”. When fixing links, keep an eye on your internal link structure. This is an opportunity to strengthen the connections between your important pages and improve the flow of link juice throughout your site.
Restore deleted content
Restoring deleted content is a bit like doing digital archaeology. You unearth lost treasures from your website, bringing them back to life and value. This is an especially useful strategy when you discover that valuable content has been accidentally deleted or that old pages continue to attract traffic despite their disappearance.
Start by assessing the value of the removed content. Use tools like Google Analytics or Ahrefs to see how much traffic these pages were attracting before they were removed. Also check the backlinks pointing to these pages. Content with lots of quality backlinks is often worth restoring, as these links represent valuable SEO capital.
Si vous avez accès à une sauvegarde de votre site, c’est le scénario idéal. Vous pouvez simplement restaurer la page telle qu’elle était. C’est comme retrouver une vieille photo dans un album oublié. Cependant, avant de la republier, assurez-vous que le contenu est toujours pertinent et à jour. Un article obsolète peut faire plus de mal que de bien.
If there is no backup, you may need to recreate the content from scratch. Use web archiving tools like the Wayback Machine to see what the page looked like. This can give you a baseline to rebuild the content. It’s a bit like restoring an old building based on vintage photos. As you restore, think about how you can improve the content. Maybe the old page was popular but could use some optimization? This is an opportunity to create an even better version 2.0. Update information, improve SEO, add rich media like images or videos.
Once the content is restored, let people know! Share it on social networks, mention it in your newsletter. If the page had backlinks, you could even contact the webmasters who linked to it to tell them it's back online.
Check your permalinks
Checking your permalinks is like doing a technical check of the structure of your website. Permalinks, these permanent URLs of your pages and articles, are essential for your SEO and user experience. A consistent and optimized permalink structure can make the difference between a tidy site and digital clutter.
Start by reviewing the current structure of your permalinks. In WordPress, go to Settings > Permanent links. There you will see different options like “Post Name” or “Custom”. The “Post Name” structure (%postname%) is often recommended because it creates short and descriptive URLs, which is good for SEO and easy to share. If you find that your permalink structure is not optimal, think twice before changing it. Changing permalinks on an existing site can cause a lot of 404 errors if not done correctly. It’s a bit like reorganizing all the streets in a city: without good signage, people will get lost.
If you decide to switch, make sure to set up 301 redirects from your old URLs to the new ones. WordPress doesn’t do this automatically, so you may need to use a plugin like Redirection to handle this in bulk. Also, make sure your permalinks include relevant keywords.
For example, "monsite.com/meilleur-appareil-photo-2023” est plus descriptif et meilleur pour le SEO que “monsite.com/p=123“. C’est comme donner des noms de rues significatifs plutôt que de simples numéros.
Be careful with permalinks that are too long. Keep them concise while remaining descriptive. A long, complicated URL is difficult to share and may be truncated in search results.
Create a custom 404 page
Creating a personalized 404 page transforms a frustrating dead end into an engagement opportunity. It's like installing a useful and welcoming information sign where visitors expected to find a brick wall. A good 404 page can turn a potentially negative experience into something positive, even memorable.
Start with tone. A touch of humor can ease the frustration of arriving at a non-existent page. Think of a lighthearted joke or funny image related to your brand. For example, If you sell shoes, you might say “Oops, looks like this page has run away!” However, make sure the humor matches your brand image.
Then, be clear and reassuring. Simply explain what happened: “The page you are looking for does not exist or has been moved”. Add a brief apology, but don't go overboard with excuses. The most important thing is to provide useful options for visitors. Include:
- A link to your home page
- A search bar to help visitors find what they were looking for
- Links to your most popular pages or main sections of your site
- If relevant, a link to your sitemap
Consider including your contact details or a link to your contact page. Sometimes visitors arrive at a 404 page looking for specific information, and providing them with a direct way to contact you can be greatly appreciated.
For e-commerce sites, consider adding suggestions for popular products. It's as if in a physical store, a salesperson guided a lost customer to the most interesting sections. From a design perspective, make sure your 404 page matches the overall aesthetic of your site. It should include your regular header and footer to maintain navigation consistency.
Check your .htaccess file
This small, often overlooked file plays a crucial role in the configuration of your Apache server and can be the source – or solution – of many 404 error problems.
First, locate your .htaccess file. Il se trouve généralement à la racine de votre site web. Attention, c’est un fichier caché, donc vous devrez peut-être configurer votre client FTP ou votre gestionnaire de fichiers pour afficher les fichiers cachés. C’est un peu comme chercher une clé cachée sous le paillasson numérique de votre site. Une fois que vous l’avez trouvé, faites-en une sauvegarde. C’est crucial. Modifier le .htaccess sans sauvegarde, c’est comme faire de la chirurgie sans filet de sécurité. La moindre erreur peut rendre votre site inaccessible.
Examine the contents of the file carefully. Look for lines that might cause unwanted redirects or block access to certain pages. Common mistakes include poorly configured rewrite rules or overly strict security guidelines. If you're using WordPress, make sure the rewrite rules for permalinks are set up correctly. They generally look like this:
Copy
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Si ces lignes sont absentes ou mal configurées, cela peut expliquer de nombreuses erreurs 404. Vérifiez également les redirections. Des redirections mal configurées peuvent causer des erreurs 404 ou des boucles infinies. Assurez-vous que chaque redirection pointe vers une URL valide. Si vous avez récemment migré votre site ou changé de structure d’URL, vérifiez que les règles de redirection correspondantes sont en place dans le .htaccess. Attention aux règles de sécurité trop agressives. Parfois, dans un effort pour protéger votre site, vous pouvez accidentellement bloquer l’accès à des pages légitimes.
If you find any lines that are suspicious or don't understand, don't delete them blindly. Research their function or consult an expert. It's like finding an unknown electrical wire: it's better to understand its role before cutting it. After making changes, test your site thoroughly. Verify not only that the 404 errors are resolved, but also that the rest of the site is working properly.
So, remember to regularly analyze your site to limit the presence of 404 errors and apply fixes when necessary. If you ever lack time, the Web is not your specialty or you want to develop your SEO strategy, our team of experts can support you on a daily basis to ensure the success of your company.
Contact our team now to get more details on our service offerings.
Leave comments