4 reasons I host my own URL shortener

Most of us have clicked on a bit.ly or t.co link without a second thought, and these links are practically everywhere. These are known as link-shorteners, or URL-shorteners, and these services are baked into social platforms, email tools, and even print ads. Plenty of people use these for all kinds of things, but why use a publicly-hosted URL shortener when you can host your own instead?

Here’s the thing with URL shorteners: they collect a lot of data, and that data goes to the companies that you use to make those URLs. If you self-host both the domain and the database yourself, you decide how long links live, how data is stored, and how each redirect behaves. This has a few benefits, and these benefits are ones that a public shortener can’t match.

Plus, you own the data

One of the biggest benefits of self-hosting a link shortener is the complete control that you have over it. Back in 2018, Google announced the deprecation of its own shortening service, called “goo.gl”, and eventually shut it down completely in the summer of 2024. That meant any URLs on the service were permanently dead, and anything that used a hardcoded goo.gl link would no longer work. While developers had years to make their move and get off the service, that’s not quite the point. The lack of control is the issue, and self-hosting your own service means that you don’t ever have to worry about that.

What’s even better is the complete control. If you shut down your link shortener, you know it’s truly gone. There’s no worry that the links are still in some database somewhere, and it means that when they’re gone, they’re actually gone.

Flexibility and rule-based redirects

Passwords, expiry dates, and more

self-hosted-url-shortener-snapp-4

Depending on the URL shortener that you use, you can do a lot of fun things with it. Most URL shorteners will allow you to replace the URL if it breaks while maintaining the same link, while others will allow you to do a whole lot more, too. I’m using Snapp, which is a fairly basic shortener, but it allows for link expiration, setting a secret password for accessing the shortened URL, and a maximum number of uses can be set before it expires. And that’s for a basic self-hosted shortener. Tools like Shlink will offer a lot more.

There are many options to choose from, and others you could try out include YOURLS, Polr, and Kutt. Snapp took mere minutes to set up and deploy, but the other options are all worth looking at, too.

Recognition and a personal touch

Your own URL is better than a generic bit.ly

Self-hosted URL shortener showing options that can be set

If you’re hosting a URL shortener on your own server with your own domain, then you can have a personal touch with every URL that you share with others. You don’t need to rely on generic bit.ly addresses; you can have it be what you want, when you want, and that’s great for both businesses and for individuals who just want to have a bit of personality in their shortened URLs.

Many tools also offer native QR-code creation, and Snapp does too. That means you can create a custom short URL for something else, put it in a QR code, then share that QR code with others. Other services that offer a similar QR code creation ability for a URL will have built-in tracking and may even have a limited time that the QR code is active for which can only be unlocked by paying money, so not only does it add a personal touch, but it can be cheaper, too.

Better analytics

Many URL shorteners give you more data

Cloudflare proxy for URL shortener

If you want to see who’s clicking your link and from where, that’s another place where a self-hosted link shortener can come in handy. You can use the links as part of a marketing campaign, or simply share them on social media and then see where people are clicking the link from. It gives you additional statistics, and many self-hosted services give you the option of deciding what data is collected and how. For example, Snapp by default just shows geolocation data and doesn’t have many other tracking options.

Of course, if you’re using something like Cloudflare Proxy to route traffic to your self-hosted URL shortener, then much of this data will be abstracted. A proxy works both ways; your URL shortener will only see the IPs from Cloudflare’s CDN, though your IP address isn’t exposed either. Snapp may not have it all, but comparable tools like Shlink and YOURLS do.

A URL shortener can be a powerful tool

While you may not necessarily have a need for a URL shortener, they can be extremely useful to some people. Generating a QR code that can point to a site of your choosing can be great, and I’ve used it for things like QR codes that point to a Discord invite when I’ve run events in the past. You could also use it for your own self-hosted services if you didn’t want to create a lot of A records for individual services, though this would require a lot more setup with your reverse proxy to only accept traffic from the correct referrer. Still, it’s worth playing around with, especially if you have ideas of how it could be useful to you!

Continue Reading