The broken links bible - article 3 of 3

How to fix broken links

Take that spanner out of the works - fix broken links like a pro.

In part one we saw all the different types of broken links, what they mean and why they happen. In part two we talked about how to find your broken links. Now we want to talk about how to actually fix broken links, so they don't annoy your visitors.

The good news is that fixing broken links is actually really easy. You just need to figure out what went wrong (there aren't many possibilities) then change or remove the offending link.


Figuring out what went wrong

We'll assume you're using a link checker to find your broken links, as suggested in part two. When a broken link is found the software will give you an error message like one of these:

Timeout
Couldn't contact server
404 error

As a reminder, let's take another look at the diagram from part one.

Remember, generally if the error says something like 'Couldn't contact server' or 'timeout' then the issue is usually with the first part of the url (the domain). If the error has a numeric code, most commonly 404 then the issue is with the path.

Knowing this, it's pretty easy to figure out how fix broken links.

If the problem is with the domain (a 'couldn't contact server' / 'timeout' error) then the domain was mistyped or the site is down. If the site is down the link should be removed or pointed somewhere else if you don't believe the site is ever coming back.

If the problem is with the path (e.g. a 404 error) then the link will need to be removed or changed to a new url. If it's pointing to a page on your site that you removed or renamed you can put the page back up or change the name back. If it's pointing to a page on another site you can find some new, similar content to point your link to or remove the link.

We've created the following easy to use decision tree to make this simple:

Now you know what changes you need, here's some simple instructions for how to make them.

Making changes

Broadly, editing web pages to fix broken links falls into two categories, either editing the html directly for sites based on flat html files or using an editor in a CMS such as WordPress. First we'll take a couple of examples for how to handle flat html pages then an example in wordpress.


The DeepTrawl html editor

Our desktop link checker app (DeepTrawl) includes an integrated html editor. When a site is checked for broken links they appear like this:

To see the broken link in your html, click 'View in Editor'. The editor will pop up and select the broken link, like this:

To remove the link you can simply cut it out (all of <a href="http://www.example.com/brokenLink.htm">Click Me</a>). If you do that you may want to edit the text around it if the link is mentioned.

To change the url of the link to something new, simply change the text (http://www.example.com/brokenLink.htm).

Once you're done with your changes you can save the file and FTP it to your web server.


Dreamweaver

Dreamweaver is probably the worlds most popular html editor so it's natural many will want to use it to fix broken links.

Firstly, note down the page where your broken link was found so you'll be able to locate it in your html. Next open the file in Dreamweaver and find the link in your html. Below we've highlighted a broken link in the same dummy html from before:

Fixing the broken link in Dreamweaver works just like in the DeepTrawl editor. Either remove the whole link (<a href="http://www.example.com/brokenLink.htm">Click Me</a>) or edit the url (http://www.example.com/brokenLink.htm)).

You can now save the fixed html file & FTP it to your server.


WordPress

Fixing broken links in a CMS such as wordpress works a little differently, but is still very simple.

First, edit the article containing the broken link:

Now, highlight the broken link in the editor:

Now you can either delete the link (remember to edit any relevant text around it). Or, to change the url of the link, click the 'Insert / Edit link' button:

Now you'll see the 'Insert / Edit link' window:

Now you can change the url as discussed in the 'Figuring out what went wrong' section of this guide.

Done!

You now have all the skills needed to rid your website of pesky broken links. Your visitors will never be annoyed by them again. Just in case you're still not convinced by how irritating they can be, here's a cool related TED video:

Check out our software

We have two products which can help you with issues like this in your site.


DeepTrawl

DeepTrawl is a desktop app for Windows & Mac which checks every page of your site for issues like broken links, spelling mistakes, & invalid html.
Tell me more!

CloudTrawl

CloudTrawl is a hosted webapp (nothing to download) which regularly checks your entire site for broken links automatically. It also monitors your uptime and sends you text alerts when there's a problem. Because it's in the cloud results are super-easy to share with others.
Tell me more!





comments powered by Disqus