If you have a website, I’m sure you’ve put a lot of hard work and long hours into making it a valuable resource for your visitors. But if your links aren’t working, it can derail all of your hard work. Broken links on your website can be harmful in two ways:
To avoid these potential pitfalls, you should periodically check for broken links on your entire website. If you’re wondering how to do this, you’re not alone. The good news is we’ve done this work before and we’ve documented everything in a step-by-step, easy-to-follow process, which we hope you find helpful. So here is a comprehensive guide to helping you find and fix broken links across your website.
There are a number of tools you can use to identify broken links, many of them free.
Google Analytics is a great free tool for tracking website performance, and it’s also helpful for easily finding broken links. First, log into your Google Analytics account and click on the Behavior tab. Then select “Site Content” and then “All Pages.”
Make sure to set the evaluation period for the amount of time you want to look at. If you check for broken links monthly, set the period for the month since your last check. Here I have set it for July 1 – July 31, 2020.
Now when you scroll down, you’ll see viewing options. It will most likely be set to the default “Page,” but be sure to instead select “Page Title.”
Now you can create a page title filter. Click on the “advanced” option as seen below:
Once you’re in the “advanced” window, set up your filtering to Include >Page Title>Containing>”Your 404 Page Title,” just like we’ve done below:
Once you click “Apply,” you will then be presented with one or more page titles containing that name. Since this was only a one-month range, we only have one.
Click on the page title itself and you will then see the links that are broken and resulting in that 404 page:
In the full screen view, at the top we can see that the 404 error has occured 2,071 times, and at the bottom, if we were to scroll all the way down, we’d see that it occured via 964 pages:
You can then export this report into a spreadsheet and fix the links if you know all of the places they occur on your website, or set up redirects to go to the intended page.
All kinds of nonexistent or broken links will trigger the 404 error page. Most websites have a simple message, but it’s a best practice to give the visitor an action to take. You may include a link to your homepage, your blog homepage, or a contact us page.
From our blog post on examples of great 404 pages.
Google Analytics offers the ability to set email alerts to get these broken link reports on a regular basis, as well as to export broken link details. Remember that redirecting and fixing broken links is an ongoing process. For the average website, once per month is an appropriate cycle.
Another free tool we recommend is Xenu Link Sleuth. After you’ve installed the Xenu software and opened the tool, go to File – Check URL, and enter your website’s domain. Uncheck the box named “check external links”, and click “OK” to run the analysis. Note that if it’s the first time you’ve used Xenu, it can take a little while to complete the report. So be patient.
After identifying your broken links, create an Excel spreadsheet to track link redirect processes. Name it something like “Broken Link Redirect Report.” In Google Analytics, you can export the report you just created by clicking Export – CSV for Excel on the top of the page, and downloading the file. For our purposes, we only need the data on broken links, page views and unique page views, so copy and paste these data columns into the Excel spreadsheet you have created.
You can export data from Xenu too; click on File, then Export to Tab Separated File, and then open that text file with Excel.
Next, organize the main data from Google Analytics and Xenu into separate sections on your Excel spreadsheet. It will look similar to this:
After all the preparation, we come to the important stage. Both Google Analytics and Xenu give us a list of links that may be broken. But before actually redirecting them, you should first analyze the pages and the reasons they may not be working properly.
From the Google Analytics section of the short sample above, we can see that not all broken links are created equal. Some links are actually visited quite often while others are not. Many instances of broken links or visits to a stray URL occur only once. These URLs may be a product of human error or someone mistyping an incorrect URL into the address bar and may not be worth fixing, like links #7 and #8. However, broken links with multiple visits are probably worth the time and effort to fix as they show a trend (even if it is one of human error).
Also, for some links, we can easily figure out the correct URL and fill in the data in the spreadsheet; for other links, we can put a tentative URL there and highlight it with a different color; and for the rest of the links, we can redirect to the domain homepage. In conclusion, we will only redirect the links with many visits and those with an underlying error-causing rule.
The Xenu report has the advantage of not displaying URLs that were recorded in your analytics because of a typing error. All the links shown in Xenu are actually existing links that live on the site. But these URLs may still contain character errors. For example, links #4 and #5 are caused the by the same problem: “#” is replaced by “%2523.” When we identify these instances, we need to determine the cause and fix the same problem across all instances.
This step will be complete once you’ve located the links that need to be redirected and documented them all in your Broken Link Redirect Report.
Finally, it’s time to actually redirect the broken links in your content management system (CMS). I will use WordStream’s Drupal CMS as an example.
Go to Administration – Site building – URL redirects. Click “Add redirect”. Fill in the “From” and “To” blanks by copying and pasting from the final Broken Link Redirect Report. Pay attention to the link format during the process. Select “301 Moved Permanently” in the drop-down Redirect Type menu. Click “Create new redirect”.
Repeat the above process to redirect all the broken links and update the Broken Link Redirect Report.
Mission accomplished! Now you can have even more pride for your website because ALL your links work, making both users and the search engines happy!
Please read our Comment Policy before commenting.