In the past week, the web development community received some news that many believed was inevitable, but came a lot sooner than expected: a major URL shortening service (in this case, tr.im) was shutting down. tr.im has since announced plans to stay in business, but even if they do, this serves as an important warning.
URL shorteners like tr.im have been all the rage since Twitter now famously encouraged us to express ourselves in 140 characters or less. These services take a relatively long URL (like the one you can see in the address bar if you’re reading this in a browser) and generate a teeny, tiny URL that redirects to it, which you can use to save characters when mentioning the link on Twitter.
URL shortening has become a competitive space, with contenders like TinyURL, is.gd, Metamark, ow.ly, Su.pr, thurly, tinyarro.ws, and TweaK. Each of these services offer a different combination of URL length, API support in third-party Twitter clients, URL visit tracking with statistics, and other novel features.
With its five-character host name and solid click stats, tr.im had fared well in the race. But when Twitter endorsed competitor Bit.ly by using it to auto-shorten URLs posted through twitter.com, tr.im faltered. Facing a long slog with no clear way to make money at the end of it, tr.im decided to shut down, and web developers went nuts.
The bright side was that all good URL shortening services send browsers onto the full URL using a permanent redirect (also known as a 301 redirect, after its HTTP response code). That means search engines like Google will follow the redirect to its target and only index that.
But, unlike Google, some people publish a URL without following the redirects. Many bloggers routinely copy shortened URLs from Twitter into blog posts verbatim, so when a URL shortening service like tr.im disappears, those links are broken.
In response to the outcry from developers, tr.im relented, scrapping its plans to, er, scrap the service. tr.im has now pledged to press on as a community-owned service, but without a plan to offset its ongoing hosting costs, tr.im’s public backflip may cost it the race.
In short (no pun intended!), URL shortening services significantly weaken the lattice of hyperlinks that hold the Web together. Developers who want reliable, permanent short links to their stuff need to find a better way to provide them.
The only way to free your short URLs from the risk of another individual breaking them is to generate your own and host them on your site. If you’ve done much server-side development, you can probably sketch out how to code this in your head fairly quickly.
If you aren’t a developer, you can check out some of the URL shortening plugins that have begun popping up. la petite url is a WordPress plugin that will generate short URLs for the posts on your blog automatically. Similar plugins are popping up for most popular blogging platforms and content management systems, but if you can’t find one for your particular publishing platform, Shaun Inman’s just-released Lessn is a solid standalone URL shortener that you can host yourself.
Of course, providing your own short URLs only solves the problem for links that you post yourself. Others may still link to you using fragile, short URLs created using one of the above services.
A proposed solution to this problem is short URL auto-discovery. The idea is you include in the head
of your document a tag that advertises the short URL for this page:
<link rel="shorturl"
href="http://example.com/1234"/>
The latest short URL plugins (including la petite url) will add this tag for you automatically.
In theory, Twitter clients and other software that needs to obtain short URLs will load your document, spot this tag (or the HTTP header equivalent), and use your published short URL rather than generating one using a third-party service.
In practice, although a handful of forward-looking sites are now publishing short URLs using this method, we have yet to see the first widely used application to support short URL auto-discovery. We can probably look forward to this happening soon, but the big win everyone is hoping for is that Twitter itself realizes the value of publisher-supported short URLs and begins using them instead of bit.ly when they are available.
Of course, Twitter could simply disregard URLs for the purpose of the 140-character limit and banish the evils of short URLs forever. Yeah, and monkeys might fly out of my butt.
Frequently Asked Questions about Hosting Your Own Short URLs
What are the benefits of hosting my own short URLs?
Hosting your own short URLs provides several benefits. Firstly, it gives you full control over your links, allowing you to customize them according to your branding needs. Secondly, it enhances the security of your links as you have complete control over where they redirect to, reducing the risk of users being directed to malicious sites. Lastly, it can provide valuable insights into user behavior, as you can track click-through rates and other metrics.
How can I set up my own URL shortener?
Setting up your own URL shortener involves a few steps. Firstly, you need to choose a domain name that is short and easy to remember. Next, you need to set up a hosting account and install a URL shortening script. There are several free and paid scripts available online. Once the script is installed, you can start creating and managing your short URLs through the script’s interface.
Is it possible to track the performance of my short URLs?
Yes, most URL shortening scripts come with built-in analytics features that allow you to track the performance of your short URLs. These features can provide valuable insights into user behavior, such as the number of clicks, the geographical location of users, and the devices used to access the links.
What are the security considerations when hosting my own short URLs?
When hosting your own short URLs, it’s important to ensure that your server is secure and that your shortening script is regularly updated to protect against vulnerabilities. Additionally, you should regularly monitor your links to ensure they are not being used for malicious purposes.
Can I customize my short URLs?
Yes, one of the main advantages of hosting your own short URLs is the ability to customize them. This can be done through the URL shortening script’s interface. Customizing your URLs can enhance your branding and make your links more memorable.
What is the cost of hosting my own short URLs?
The cost of hosting your own short URLs can vary depending on several factors, including the cost of the domain name, the cost of the hosting account, and the cost of the URL shortening script if you choose to use a paid one.
Can I use my own short URLs for social media marketing?
Yes, short URLs are ideal for social media marketing as they are easier to share and take up less space in posts. They can also be customized to match your branding, making them more effective for marketing purposes.
How reliable is hosting my own short URLs?
The reliability of hosting your own short URLs largely depends on the reliability of your hosting provider. It’s important to choose a reputable provider that guarantees high uptime and provides good customer support.
Can I migrate my short URLs to another provider?
Yes, it’s possible to migrate your short URLs to another provider. However, this process can be complex and may require technical expertise. It’s important to ensure that the new provider supports the same URL shortening script to ensure a smooth transition.
What happens if my short URL is flagged as spam?
If your short URL is flagged as spam, it may be blocked by certain websites or email providers. To prevent this, it’s important to ensure that your short URLs are not being used for spammy or malicious activities. Regular monitoring and prompt action can help mitigate this risk.
Kevin Yank is an accomplished web developer, speaker, trainer and author of Build Your Own Database Driven Website Using PHP & MySQL and Co-Author of Simply JavaScript and Everything You Know About CSS is Wrong! Kevin loves to share his wealth of knowledge and it didn't stop at books, he's also the course instructor to 3 online courses in web development. Currently Kevin is the Director of Front End Engineering at Culture Amp.