The web is built on hyperlinks. Linking between web pages is a fundamental feature. When all is well and good, every link on our site will lead exactly to the right place.
But sometimes links go bad.
A page may be deleted or unavailable. An image might not load or be missing. A site or resource you link to might disappear. Someone might move a post or page and not update others which link to it.
What happens then, when your links get broken?
Why are Broken Links Bad?
When someone clicks on a link on our site and it fails to take them to its intended destination:
- It’s a source of frustration for the user.
- It gives the impression that you don’t do regular housekeeping.
- It can harm your credibility as an authority.
- It could affect your website conversion if it’s on a sales page.
- It can hurt your SEO and page rankings.
The worst result for the user clicking on a broken link is to be sent to a generic browser 404 page. Then the user has to click the Back button to return to the previous page. A little better is a custom 404 Page not found.
But ideally we want to identify those links that are broken and modify or remove them.
Identifying broken links
There are a number of tools to help spot broken links.
The Broken Link Checker plugin for WordPress
Once you install it, it’s configurable through Settings > Link Checker. Once you have selected your settings, it will go through all the links chosen and list any that are broken.
On the Broken Links page, you will see:
- The URL
- The Status Code
- The Link Text
- The Link Source (this may be a page, post or comment, for example)
Some bad links are listed as ‘Warnings’ – this means that they are likely temporarily broken.
You choose what kind of links to check – posts, pages, media and even comments.
The plugin monitors your links constantly and warns you of any broken links. You set the time interval for checking.
You can get emails letting you know about broken links.
Search engines can be prevented from following the broken links.
The plugin provides built in tools to tidy up your broken links.
It can take a long time to analyse your links if you have a large site and many of them.
The plugin can be resource-hungry – some hosts such as WP Engine have banned it, and some people say it’s slowed down their site.
It sometimes shows false positives i.e. links that aren’t actually broken.
It has been reported that it marks valid https:// links as broken.
Fixing broken links with Broken Link Checker
You have a number of options:
Edit URL – change the URL if it is misspelled or you find there’s an updated link. The Suggestions option may give you an alternative link.
Unlink – if the link has ceased to be, remove the link (this affects all posts).
Not broken – if you think the plugin is wrong and the link is valid, use this option to mark the link as okay.
Dismiss – hide the link; if its status changes it will be reported again.
Recheck – test the link for validity again.
Checking Broken Links Online
There are a number of websites to do this. I tried out Broken Link Check.
Enter your website URL and complete the CAPTCHA, and it will check over your site links for you.
The links are listed in a table for you.
The tool will also spot malformed URLs e.g. ones that begin ttp:// rather than the proper http://.
Fixing broken links found by Broken Link Check
In this case, you will need to find the URL of the page where the broken link is on your site. It’s listed under URL.
The source code is listed under src in the table. Clicking on this helpfully shows you the broken link highlighted.
You will need to go to the broken link on the relevant page and edit or remove it yourself.
If you decide to remove a live web page on your website, the correct thing to do afterwards is to redirect the browser so it knows that the link has changed. A bit like redirecting your mail when you move house.
You choose the new location to send the user with a 301 redirect. A 301 redirect tells the browser that the page has moved permanently to a new address.
If you have WordPress: the Redirection plugin
The Redirection plugin provides a user friendly way to redirect URLs on your site.
Once installed, go to Tools > Redirection.
Add a redirect by entering the source URL (the missing page) and the target page (the one you want users to go to). Save.
Now anyone requesting the old URL should be automatically taken to the new one.
If you don’t have WordPress: create a 301 redirect in .htaccess
It’s simple enough to do this, but you need to be comfortable with editing your website’s files.
Look for the .htaccess file in your website’s root directory and download it. You will need FTP access from your web host.
If there isn’t an .htaccess file, create a file in a text editor and save it as .htaccess (choose the * all files option, not .txt).
If you downloaded the file, make a copy before you begin editing it.
Add the line below to your .htaccess file – replace the URLs with your old one and the new one you want to redirect to.
Redirect 301 / http://www.example.com/old-page/ http://www.example.com/new-page/
Repeat this step for each URL you wish to redirect.
Save the file and upload to your website, overwriting the old file if necessary.
- Broken links on your site don’t give the best impression.
- There are free online tools to find and fix them.
- Always redirect pages if you delete or change the URLs.
- Have a helpful 404 page not found as a fallback.
I’m off to sort my broken links now. 🙂
Did you find this article helpful for fixing broken links? Let me know your thoughts by leaving a comment below.