Setting up a custom URL shortening service using Bitly.Pro

If, like me, you’ve been reading the stories about Libya taking back control of certain .ly addresses, then you might be thinking “what about all those short URLs I’ve been sharing?”. For those who haven’t read the story, the Libyan authorities have been reclaiming addresses from sites whose content breaches Sharia law.  Bit.ly, the American-based link shortener that’s become very popular since the demise of tr.im doesn’t think it’s at risk, even though some of the content it signposts might offend those of a Muslim faith, because: it doesn’t actually host the content; and bit.ly addresses are also accessible using the slightly longer bitly.com URL (for example, bit.ly/markwilsonit resolves to the same address as bitly.com/markwilsonit).

Even so, I decided to implement my own custom domain for link shortening – one that I have control over.

I decided to stick with a top level domain from a country that’s not likely to take back the address and, even though Italy (.it) is a slight risk to me as I don’t live/work there, .it domains are officially available to anyone who resides within one of the European Union member states (and that includes the UK), giving me some legitimate claim to the domain at least. Unfortunately, I found that I couldn’t register any 2 or 3 character domains, but Matt Marlor suggested I go for mwil.it and, yesterday, I successfully registered that domain.

Incidentally, if you’re looking for a short domain name, DomainR is a website that will work through various permutations of your name/company name and flag those that are valid/available.

Grabbing the domain is only the first step though – I also needed a link shortening service. I could have implemented my own (indeed, I may still do so) but decided to use the Bitly.Pro service instead, thinking that I can still migrate the links at a later date, should that become necessary.

One of my friends, Alex Coles, asked why I selected the Bitly.Pro route rather than using a script like YoURLs and, aside from the fact that would be something else for me to manage on my webspace, the Bit.ly API is widely supported by many of the other services that I use – like TwitterFeed, and TweetDeck – reducing the effort involved in generating new short links.

At the time of writing, Bitly.Pro is still in beta but I completed the form to apply to join and, shortly afterwards, received an e-mail to say I was in. At that time I hadn’t registered my domain but, once that was done, it was a simple case of:

  • Creating a DNS A record (actually, I created two – one for * and one for @) on the short domain (mwil.it) to point to Bit.ly’s servers (168.143.174.97).
  • Adding a DNS CNAME record (3bae9d57b0bf.markwilson.co.uk. CNAME cname.bit.ly) to my tracking domain (markwilson.co.uk) to prove ownership (other options included uploading a file or adding some metadata to the site).
  • Waiting for DNS propagation (which didn’t take long for me but may have been up to 24 hours) and verifying the details in my Bitly.Pro account settings.

With these steps completed, I had everything in place to start generating short URLs using Bitly.Pro, but the was one more step for my client applications – TwitterFeed and TweetDeck both needed to be provided with an API key in order to use the Bit.ly API with my account (TweetDeck even gives the link to go and get the key). After entering those details, I sent a test tweet and was pleased to see it using the mwil.it domain, with no additional work required on my part.

So, what’s left to do? Well, I still don’t know why sites like the New York Times and TechCrunch get custom URLs when I link to them, even without an API key (I suspect for that I would need an Enterprise account) and it may still be prudent to keep an offline copy of my short-long URL mappings, just in case Bit.ly should ever cease to exist. There are also some client applications that don’t use my custom shortener (for example, Twitter’s own app for the iPad uses another Bit.ly domain, j.mp, and doesn’t appear to have any options to enter an API key) but at least my auto-posted tweets (i.e. links to my blog posts, etc.) now use a domain that’s under my control.

Leave a Reply

%d bloggers like this: