Check if an URL shortener does its job.

There are different scenarios why you should check the functionality of your URL shortener. For example a new VirtualHost on your webserver or some DB-changes or own PHP-hacks or -patches might break the shortener. If you maintain lots of services it’s likely that you forget to manually check the functionality of your software, so this plugin will help you! Of course you can also check foreign shorteners, whether some shortened URL’s are still accessible.

To check the shortener provide a shortened URL with --short :

usr@srv % ./check_url_shortener.pl --short s.binfalse.de/1
redirecting works perfectly: 301 -> /

You can also check if the redirection is as expected. Provide an expected target with --expect :

usr@srv % ./check_url_shortener.pl --short s.binfalse.de/1 --expect /
redirecting works perfectly: 301 -> /

To run this plugin you need to install curl! This plugin just downloads the header of the shortened URL and makes sure the response code is 301. If you provide an expectation it additionally compares it with the new location.

Here is the code.

Dependencies

Please consider to take a look at my general setup notes.

Download: Perl: check_url_shortener.pl (Please take a look at the man-page. Browse bugs and feature requests.)

Martin Scharm

stuff. just for the records.

Do you like this page?
You can actively support me!

Leave a comment

There are multiple options to leave a comment: