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: https://github.com/YOURLS/YOURLS/archive/master.zip
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:
- The first step is to set the details for the database that you are going to be using with YOURLS. You then need to define the domain name that you are configuring YOURLS to work with, i.e. the domain pointing to where you put these files.
- Next, you need to provide your timezone’s offset from GMT. Then, if you need to use a different language than English, add the details of the translation file to use.
- The next few settings can be left at their default. After that, you can enter a long string of random text to encrypt the YOURLS cookie data in the cookie key .
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 http://your-domain.com/admin/ replacing “your-domain.com” 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.
This article was brought to you by VPS.net, for dedicated server hosting, cloud servers and 24/7 support visit our site here vps.net