Skip to content

How to create your own URL shortener

27 mayo, 2021

The rise of social networks, especially Twitter where it rewards summarizing by the maximum length of 140 characters of each message, has led to the birth of shortened internet addresses. Surely you have seen them somewhere: you click on them and they redirect you to a website with a much longer URL.

Services like or TinyURL began to offer these short addresses to everyone, but as everything has become more complex, these addresses have begun to hide many more secrets and utilities. Now, for example, it doesn’t cost too much to create your own URL shortener. Let’s see how we can achieve it.

Basic theory: what is a URL shortener and what is it for

Strictly, a shortener consists of a web address that redirects to another web address. As simple as that. It seems absurd, but the short length of that first web address makes it much more suitable for posting on social media. This address takes up much fewer characters:

That this other one, that by itself eats us almost the entire length of a tweet:

In addition to saving space, short addresses have other uses. This redirection can be used to measure how many times a certain message on the networks is clicked, check the origin from where it is clicked … or even maintain a permanent short link whose redirection can change over time.

A quick example: if I want to offer a sale product every week, I can always set a short address using a service such as Every week the redirect of that short URL would change, and so I would not have to change the address every week for all the websites where I promote that offer. This, along with all the analytics that originate, make the links shortened something very useful.

Services to create a shortener with your own domain

Typically, if you want to shorten an address, you can go to a free service like or TinyURL. But maybe you want to go further: maybe you have bought an internet domain and you want to take advantage of it to, in addition to being able to redirect your website, be able to generate your own short addresses.

In that case you have the possibility to do it installing on your web server a tool that generates those short addresses and allow to manage them. Some examples of these tools are Yourls or PHUrl, which are installed in the hosting you use and offer you a control panel from where you can shorten any link and track the redirect traffic you generate:

Yourls 2
Yourls 1
Yourls 3
Yourls 4 Some screenshots of the YoURLS control panel, where we can monitor details such as the traffic generated by a short URL or its origin.

The requirements to install any of these tools are usually not demanding: we are talking about something that simply redirects URLs to us and monitors their traffic, so that our web host is enough have PHP, Apache and capacity for a MySQL database.

For those who want something more visual and simple, that does not require web servers, you have other options: CloudApp is an application for OS X that is installed in the system menu bar, and to which we can drag any link to generate one shortened using our own domain. Their payment plans that allow us to do that start at $ 8.25 per month.


Clkim is another web-based service, but it does not require server installations. From 7 dollars a month we can access a control panel that allows us to monitor all the activity of our short links.

They are, after all, services of various types but that they meet the same goal: manage each and every one of the addresses that we shorten and analyze their traffic.

Image | Chris Dlugosz
In Genbeta | 15 tricks, extensions and resources to search for images on the Internet