Rythie's Blog

Technology and stuff

Federated Short URLs

With the demise of the tr.im URL shortening service, the inevitable debate about shortening services has arisen. The key problem is that these URLs are lost if the service is shutdown and lots of links remain broken forever with no idea of what domain they were on let alone the specific page.

I must say, I'm not really convinced there is a need for URL shorteners outside Twitter, and they should provide a service of their own or avoid the need for it altogether. Nevertheless, there are lot of these services and here is what I think could be done to avoid a tr.im style problem again.

The solution would be a federated URL shortening system, such that all participants share the same shortening codes.
i.e.
http://bit.ly/Bxxxxx
would be the same as
http://tr.im/Bxxxxx

This is how I think it could work:

It's based on the same ideas of a hierarchical addressing used by IP addresses, postcodes, phone numbers etc.

We assume that these codes (i.e. the bit after the slash) are Base62 - i.e. each character could be a-z, A-Z or 0-9.
The shortening code would be split into two parts: a vendor part and a URL part.

i.e. bit.ly gets everything starting "B" leaving them 5 digits or 916 million addresses (625) to play with however they like.
trim gets everything starting "T" also leaving them 916 million addresses
Some small site could also get in the game with a smaller set initially, i.e. they get addresses starting "AAA" leaving them 3 digits or 238,328 (623) addresses to work though until they take off (which may never happen of course)

Everyone in the system would be responsible for approving short URLs onto the system for their subsection of the space. They would notify others in the system immediately and if a URL has already been shortened by another site, they would use the same code but serve it up as their own. I.e. tr.im finds that bit.ly has already shortened a URL as http://bit.ly/Bxxxxx so tr.im takes that code and serves it up as it's own http://tr.im/Bxxxxx and this way the user of the URL can get statistics and such. It's quite possible that if URLs are shortened on different sites within seconds of each other that two or more codes for the same URL will exist and that would probably less than 0.1% and could be accepted as an inherent inefficiency that would not be fixed.

As codes run out the prefix could be extended from 1 character to 2 or even 3, giving 62 times as many addresses in each case, giving multiple blocks to companies as necessary.

If a company wants to exit the game it would be suggested that it sells it's domain to an existing player. A DNS CNAME entry to the new company is all that would be really required to take it over, none of the code or database written by the failing company would need preserving and could even be sold separately.

Of course the failing company could either let the domain lapse or sell it to some company who didn't intend to carry on the service (probably redirecting to some scam or illegal site). In this case lets assume the shortener was http://fa.il/. In this case one thing that could be done is to have Twitter and other sites rewrite the old URLs and serve them up on another shortener. i.e. they rewrite http://fa.il/FFFFxxx as http://bit.ly/FFFFxxx and everyone's links keep on working.

So that's it. It does require a lot of companies working together which tends not to happen.

What do you think? Could this be done? Would anyone do it?