Home >> Help >> How does a link shortener work

URL shorteners are pretty common on the web and the principals behind them are fairly simple. There are however a number of issues and real-world obstacles that you need to overcome.

When a user arrives on the website they will be presented with a text box and a button. The text box is where the user will type or paste the URL they wish to shorten. They will then click the button or press return to proceed. They will then be presented with a short link and another button, this time a button to copy the short link to their clipboard so they can later paste it.

When a user clicks the button to shorten their URL the first thing we do is make sure that the user has inserted a valid URL. We do this by first checking that the text is in the format of a valid URL. We also attempt to access the page in question to make sure the page is up at that time. If the URL is found to be valid we will then generate a short code.

The short code we generate will become the short URL slink.co/shortcode we then present the user with the complete URL with the option to copy it to their clipboard.

When a user clicks a short link provided by slink our site needs to be able to extract the short code from the full URL. We can then compare it to the record we have saved in our database to extract the full long URL destination. We then redirect the user to that destination. Most users who click one of our links will never even realize we exist because the redirect process is so fast.

There is one more step to the short links generation that we should cover. We attempt to warn users if the link they are attempting to visit could be potentially harmful. When we are creating a new short link we will attempt to work out if the destination does pose a risk. If it does we will present the user with a warning page as opposed to simply redirecting them.

We are constantly working to improve our system and roll out new code almost every day. Our aim is to ensure Slink.co is as secure, safe and fast as possible going forward.

Back to help - Slink Homepage