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

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...

MoviePass drops pricing to under $7 per month, if you opt for the annual plan

MoviePass, the subscription service that lets consumers pay a monthly fee to see unlimited movies in theaters across the U.S., is slashing its prices yet again. The company announced today it’s now offering its service for $6.95 per month, down from the current price of $9.95 per month, when customers commit to a one-year subscription plan. That works out to a flat fee of $89.95 annually. The deal is a limited-time promotion, as opposed to a permanent pricing change, but MoviePass didn’t say how long the offer is valid. However, it is open to both new and existing subscribers – the latter who would receive a 25 percent savings on their current subscription if switching over to the annual plan. This is not the first time that MoviePass has dropped its pricing. When the company introduced its $9.95 per month, one-movie-per-day plan this August, down from $15 for 2 movies per month (or more in select markets like L.A. and NYC, and going as high as $50), it saw so many new sign-up...

ASUS VivoBook X202E Windows 8 Touchscreen Laptop Review And Giveaway

It wasn’t very long ago when prices of touchscreen Windows 8 laptops soared beyond $1000. Thankfully, those days are behind us, and portable computers can easily be purchased – touchscreen and all – for under $500. That’s precisely the demographic in which the ASUS VivoBook X202E falls. When compared to a high-end laptop, its specifications might seem modest, but for laptop buyers just looking for a way to browse the web, watch videos, use basic apps, and not spend too much money, something in this budget is perfectly suitable. The question is, of course, how does the ASUS VivoBook X202E compare to others on the market, and is it the one which you should be spending your hard-earned money on? Well, you’re just going to have to keep reading to find out. Best of all, we are giving away an ASUS VivoBook X202E to one lucky winner. Keep reading for your chance to take home this Windows 8 touchscreen laptop! Introducing the ASUS VivoBook X202E Laptop The ASUS VivoBook X202...