10th March 2010

It seems even my site has fallen victim to those dreaded cruncy credits, and I've been forced to cut back on the length of my URLs. It's all down to those jerks on Capitol Hill, I tell ya.

My shiny new CMS - the one that powers this site and Deadlink, my podcast - has a cute little URL-shortener that goes with it. The CMS is named Dolphy (after American jazz saxophonist Eric Dolphy) and its shortener is dlfy.me. I was quite surprised to find a cheap four-letter domain still available in 2010.

You may be aware that it's very, very easy to write a URL shortener, hence why there's so many of them about. In my opinion the only things that distinguish them are their ease of use, whatever API they provide which allows them to work with apps like TweetDeck or other websites, and of course the number of characters in the shortened URL.

Well, my service is easily integrated into my CMS using a filter (a Django templating device), like wp.me (WordPress' service) it's intended only for use with the CMS so it has no public API, and its URLs are 20 characters long, which is pretty good going.

To build one yourslef, you simply need a short domain name, and a function in whatever language you prefer, that can create a random string of text (numbers, letters and URL-safe characters like hyphens and underscores) of a certain length, save that string to a database alongside the long URL, then match the two up when the user visits the URL containing your random jumble of letters and numbers.

The only other consideration is making sure you won't run out of character combinations. One way to dramatically increase that number is by using both upper- and lowercase characters. It's not strictly standards-compliant, but everybody does it! However, there's nothing stopping you using sequential numbers instead of a string of text, but it does kind of give away the number of records in your database... it's up to you if that matters.

Leave your comments