TUTORIALS Shorten your URLs
Build your own URL shortening service
WEB APPLICATION
Tiring of typing multiple characters and back-slashes, David Rutland sets out on a journey of creating his own URL shortening system.
OUR EXPERT
David Rutland is a tinkerer and a dilettante. He buys domains on whims and runs them from a Raspberry Pi behind the couch.
N ext time you follow a link to an article online, take a look at the address in your URL bar.
Provided the browser you’re using doesn’t hide most of it, you’ll probably notice that the actual address is somewhere in the region of 70 to 100 characters long.
That’s not a problem when you’re copying into an email, or clicking from one site to another, but have you considered what happened if you’re reading over the phone to your nan? Or painstakingly copying it character for character from the glossy printed pages of your favourite Linux-centric (who’s that?–Ed) publication? It takes forever and one slip-up means that you have to start the entire thing again.
Keeping things simple
Here at Linux Format, we use the bit.lyservice to shorten URLs for us. Feeding the full length address into the bit. ly site spits back a short, easy-to-remember string of characters. Typing that string into your browser results in you being redirected to the original URL from which the short string was generated.
As an example, if you put bit.ly/37Ws4y2into your browser, you’ll be taken to the Linux Format subscription page. That’s 99 characters condensed down to a mere 14, and if you already know that we use bit.ly, you only need to remember seven characters. It’s like magic.
Organising a domain by post is a new one to us.
But bit.ly– and services like it – are owned by other people. At the whim of another human being all of our carefully curated links could vanish. The domain could be sold, the terms and conditions could change, or God forbid, we could transgress some unread content policy causing our account to be cancelled.
URL shortening services are an example of a cloudbased service, It’s an old but true adage that cloud computing just means relying on somebody else’s machine. It would be fantastic if you free yourself of the shackles of Big Shortener by running your own service. Perhaps from that underused Raspberry Pi that’s tucked away in the corner of your living room.
Bit.ly is great but we don’t want to deal with obnoxious popups, cookie dialogues, and the sheer nonexclusivity of it.
In the world of URL shorteners, brevity is king, and a 17-character base domain rather defeats the point. You might think that in the almost 30 years since the first domains were registered, that all of the good ones – or at least the short ones – had been taken snatched up and are currently being squatted in the hopes of making their owners rich, but you’re wrong. If you’re prepared to look further afield, great names can be had.