| Drupal
drupal broken links

It's important to check links on your site to make sure they're working. Sometimes when URLs get updated, some links are forgotten. Manually checking a site for all links can be labor intensive and time consuming.

That's where Drupal's Link Checker module comes in. It's an excellent module that saves you a lot of time. This tutorial will help you to get started with it.

Configuration

  • Use our install Drupal 7 modules tutorial to install the Link Checker module.
  • Go to Configuration -> Content Authoring -> Link checker.
  • Select which areas of your site you'd like to scan with the module.
  • Select if you want it to scan internal and/or external links. I recommend both. External links are prone to break without you knowing about them, so scanning for them would be a good idea.
Use the Link Checker Module to Find Broken Links in Drupal
  • Select which types of links you'd like to check. I recommend <a> and <img> tags, unless otherwise needed. With the <img> tag enabled, it will now look for broken images too.
  • I recommend leaving the rest of the settings on this page as they are, unless otherwise needed.
  • Finally, save the configuration.

Once you save the first time, it will scan your site for content, but not actually check the status of the links yet. If you have a lot of content, it will take a while to complete and you'll see the progress bar.

In the example, I hadn't set up any comments or blocks yet, so that's why it shows 0 for each.

Finding the Broken Links

Go to Reports > Broken links.

In this area you'll find a list of any broken links. Initially, all the links will be unchecked until Drupal's cron runs.

Unless you changed the "interval" setting in Link Checker's options, the module will check for broken links every four weeks via Drupal's cron. If you want to run it manually, I'll show you how in the next step.

Let's run the cron manually to make sure everything's working.

  • Go to Configuration > Cron.
  • Click "Run cron".

Now go back to Reports -> Broken Links. You'll see a list of all your broken links. It will also include the response status and description.

In the example, I had four links total and it found the one broken link. Now, I can click on the "Edit node" link to go directly to the node and fix it.

Within the node, Link Checker gives me a notification of the broken links in the node. This is useful if you haven't accessed the Reports area recently, but you're editing the content.

As you can see, Link Checker is an awesome module that has the potential to save you hours upon hours of searching your site manually. Hope you enjoyed the intro to Drupal's Link Checker!


About the author

Nick is the Director of Support at OSTraining and you can find him in almost every area of the site, from answering support requests and account questions to creating tutorials and software.