Sales Hotline:(852)8192 5886 | Sales

English | 简体中文| 繁體中文

Customize Your Link Shortening With YOURLS

In the modern world of social media, people often try to say as much as they can with as few characters as possible. Especially with services such as Twitter limiting you to 140 characters, getting the message across in such a short message is a challenge. This gets harder still when you want to include hyperlinks in your message, allowing readers to click through for more information, as these links are often long and eat into that precious character allowance.

While a number of link-shortening services have appeared to aid in this – allowing you to shrink a hyperlink to fewer than 20 characters – these are often generic and anyone can shorten a link with them. This makes it impossible for a reader to know the legitimacy of a link before they click on it as they have no idea what domain they will end up clicking through to. Social media account hijackings mean that users are likely to be more cautious about these links.

So what is the solution?  Link shortening using your own domain is the ideal scenario, which is where YOURLS comes in. This is a web application that creates a forward for a short character combination through to a longer hyperlink. So rather than seeing a generic hyperlink that could be of questionable quality, the reader can now see a link with a domain name they trust – your domain – and know that only someone from your company could create that link.

YOURLS is a PHP application that uses a MySQL database to keep track of the links. This means that it can be used on any web hosting environment with PHP and MySQL. For the sake of this tutorial we are going to assume that you already have a server with  a LAMP or WAMP stack installed, and have created a Virtualhost for the domain you plan to use with YOURLS. You will also need to create a database for YOURLS to use.

The first thing to do is download the latest release from the YOURLS Github page:

Unzip this file and copy the files contained within the YOURLS-master directory to the root of your virtual host or web hosting space.

You now need to copy the file “users/config-sample.php” to “users/config.php”. Once this is done you need to edit the config.php file and put in the details for your hosting environment.

This file is well documented, but you do need to go through all of the steps:

Next comes an important part: the creation of an array of username and password combinations for users who can log in and create shortening links. These are added in this file using plain text, but the first time that you use YOURLS after editing this file, the passwords will be transformed into a secure hash which will then overwrite the plain text version for password security. You can have as many ‘username’=>’password’ pairs here as you need for your site’s users.

The last few settings should be fine as they are for the rest of your usage. So save this file, and you are ready to get started. If you edited the file on your local computer, make sure you’ve uploaded it to your web space.
Now you can start using YOURLS: navigate in your browser to replacing “” with the domain you have used for this site and you will be greeted with the login screen for your YOURLS admin. You can sign in using one of the username/password combinations you created earlier and start shortening URLs.