Skip to main content

Automate Checking Bad Links On Your Site With Linkchecker

checking bad linksWhen it comes to keeping your website or your blog healthy and strong in search engine listings, regularly checking for broken or otherwise bad links on your website is a very good idea.

Not only is it good for your site’s overall standings in search listings, it’s also good for your visitors. No one wants to encounter broken links on a site – it’s a sign of a poorly cared for website.
Then again, regularly checking your site for bad links can be a tedious chore. We’ve covered a few tools here at MUO that can help you stay on top of things if you have the time, like Ann’s article on Xenu Link Sleuth, and Saikat’s article on Hyperlink Checker.
Those are good solutions, but again, they require your time. Checking for bad links takes work. A better solution would be to set up an automated script on your own server (or any computer connected to the Internet) to check your website for bad links and then issue a report with all of the results. Better yet, schedule it to run weekly or monthly, and you never have to think about the task again, until there are bad links discovered.

Setting Up Your LinkChecker Script

The tool that I want to focus on is one that we’ve listed in the MUO directory before called LinkChecker.
The reason I choose that tool is because LinkChecker provides an alternative command-line alternative to the standard GUI. In the command line, all you need to do is call the linkchecker application, followed by the URL that you want to check, as well as a assortment of parameters (which I’ll get to below).
checking bad links
In the case where everything goes well, and there are no issues, the command window will look something like this.
checking bad link on the website
There are no errors, so you’re just seeing a regular status update of link counts checked by the tool. On the other hand, if you have any bad links, you’ll see the errors echoed back in the command window as shown here.
checking bad link on the website
While this is useful only if you want to manually launch the script, what we’re trying to do here is automate this command. To do this, you need to understand some of the parameters that are available with this command mode option. You can find all of the parameters and flags at the LinkChecker help page. The ones that we are going to focus on are -0 and -f. That’s the output and the file parameters.
For example, you can issue the command, “linkchecker -r1 -ocsv -Fcsv http://www.topsecretwriters.com” to get a CSV file with all of the link check results, which shows up in the root linkchecker directory under the default file name “linkchecker-out.csv”.
checking bad link on the website
The CSC file shows a full listing of all bad links found, with the link checked in one column and the time/date the broken link was found as well as the warning error script.
finding bad links
This is a very cool thing – because now all you have to do is schedule a batch command to run that issues the above linkchecker command, and every day you’ll have an updated CSV file with a list of all bad links on your website. You can use this list to go through and fix all of the bad links.
If you’re unfamiliar with how to set up such a scheduled job, all you have to do is create a batch job that has the above command in it, name it something like “CheckLinks.bat”, and then schedule that batch job to run every week or every month. Just go to Start –>Accessories –> System Tools –> Scheduled Tasks.
finding bad links
Click on “Add Scheduled Task” to add the time/date you want it to run and just browse to your batch file when asked.
finding bad links
An even cooler solution, if you’re running your own web server, would be to run the LinkChecker command on your website, output to HTML format, and the move that HTML results page to a special page on your website that you can call up on any web browser to check out.
You can have the LinkChecker tool output to HTML by issuing the following command:
“linkchecker -r1 -ohtml -Fhtml/badlinks.html http://www.topsecretwriters.com”
What this does is outputs the results to an HTML file on the local linkchecker path. You’ll want to add a line to your batch file to move that HTML file to the file path where your public HTML files are stored. Just add:
“MOVE badlinks.html d:/web-server/xampp/htdocs/badlinks/”
This way, you’ll have a web directory on your website /badlinks/ where you can call up the badlinks.html page. This is what the results look like in HTML format.
checking bad links
Using this approach, you never have to even log into the server or computer where the link check script is running. You can just check your special page and deal with the errors that you find there.
Keeping on top of bad links on your site is more important than most people realize. It also happens more often than you might think, as many of the web pages you might have linked to in that article a few years ago went out of service, leaving all of your visitors out of luck when they try to follow your link to that page.
So, give the command-line option of LinkChecker a shot and see if it lets you improve your website link quality without taking up all of your valuable time. Did you take the approach above, or did you try some other technique? Share your own experiences with the script in the comments section below.

Popular posts from this blog

How To Hide Text In Microsoft Word 2007, Reveal It & Protect It

Sometimes what we hide is more important than what we reveal. Especially, documents with sensitive information, some things are supposed to be ‘for some eyes only’. Such scenarios are quite common, even for the more un-secretive among us. You want to show someone a letter composed in MS Word, but want to keep some of the content private; or it’s an official letter with some part of it having critical data. As important as these two are, the most common use could involve a normal printing job. Many a time we have to print different versions of a document, one copy for one set of eyes and others for other sets. Rather than creating multiple copies and therefore multiple printing jobs, what if we could just do it from the same document?  That too, without the hassle of repeated cut and paste. We can, with a simple feature in MS Word – it’s just called Hidden and let me show you how to use it to hide text in Microsoft Word 2007. It’s a simple single click process. Open the docum...

Build Your Own Awesome Personal 3D Avatar with Avatara

Do you use social networks and want to build your own awesome 3D avatar? Maybe you want to send someone a cute cuddly image of yourself (kind of)? Or maybe you have your own ideas of what you would do with an Avatar… Well look no further than Avatara which I discovered from the MakeUseOf directory . You can create 3d avatars out of pre-set up templates or create your own from scratch. To start, visit Avatara’s homepage . You will see this screen: Click Get Started to umm, get started! That will take you to this screen: You see that you can build your own Avatar using an uploaded head shot like the Obama one above (just an example, guys). Or roll with one of their awesome avatars. I chose to start with a blank avatar by clicking Start with a blank avatar at the bottom of the screen. That takes you to here: I clicked on the filter at the top and told it to filter out everything but male characters and then I saw this: I rolled with Buck and continued. You need to click Select...

Ex-Skypers Launch Virtual Whiteboard Deekit

Although seriously long in the tooth and being disrupted by a plethora of startups, for many years Skype has existed as an almost ubiquitous app in any remote team’s toolkit. So it seems apt that a new startup founded by a team of ex-Skype employees is set to tackle another aspect of online collaboration. Deekit, which exits private beta today, is a virtual and collaborative whiteboard to help remote teams work smarter. The Tallinn, Estonia-based startup is headed up by founder and CEO, Kaili Kleemeier, who was previously a Head of Operations at Skype. She and three colleagues quit the Internet calling giant in 2012 and spent a year researching ideas in the remote team space. They ended up focusing on creating a new virtual whiteboard, born out of Kleemeier’s experience collaborating with technical teams remotely, specifically helping Skype deal with incident management. “Working with remote teams has been a challenge in many ways – cultural differences, language differences, a...