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:
- They make for a bad user experience – When users click on links and reach dead-end 404 errors, they get frustrated and may never return.
- They devalue your SEO efforts – Broken links restrict the flow of link equity throughout your site, which impacts rankings negatively.
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.
Step 1: Find broken links
There are a number of tools you can use to identify broken links, many of them free.
- Google Analytics
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 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 will use the WordStream account as an example, with the time period set for April 1, 2010 – April 30, 2010 on the dashboard.Go to Content – Content by Title on the dashboard, and load the page. Create a filter at the bottom by typing in the title of your website’s 404 error page in the blank box after “Filter Page Title: Containing”. The title of WordStream’s 404 error page reads: “Sorry, there's been an error and this page may not exist. Don't leave though!” All kinds of nonexistent or broken links will trigger the 404 error page. Most websites do little with this page, frustrating site visitors. But at WordStream, we optimize the page to take advantage of this valuable piece of real estate: internal links to important pages are listed right below the error, along with a “Contact Us” form. The next step is to click the “Go” button on the Google Analytics filter page. Then click on the page title to view details. In our example, the WordStream 404 error page was visited 126 times via 79 pages between April 1 and April 30. For easier navigation, you can change the rows shown per page from 10 to 100 (to see all 79 rows) at the bottom right.
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.
Step 2: Create a report and track your changes
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:
Step 3: Analyze data and decide which pages should be redirected
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.
Step 4: Redirect in CMS
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!