YOURLS. #  Matchurl

YOURLS. # Matchurl

29.Nov.2021

Nowadays, paid URL shortening services come in all shapes and sizes. They offer paid promotions at cheaper prices than you might find through Google AdWords. You can use paid URL shorteners to promote not only your website or blog, but videos,  affiliate products, and even paid submissions. While paid URL services may sometimes skew their metrics to appear more effective than they really are (i.e., there's little difference between paid links on Twitter and paid links over Bitly), they're still an important tool that shouldn't be ignored.

YOURLS is an open-source url shortener that allows you to create both private and public links. It can also help you run your own url shortening service through its small PHP scripts. It also provides a terrific plugin architecture so you can include new custom features. You can use YOURLS to create links with both sequential or custom URL keywords. It also offers powerful analytics to track multiple parameters, including referrers tracking, historical click reports, and geo-location.

The paid version of the service lets you use subdomains for your shortened URLs (i.e., paidurls . YourLinkPlease .com) as well as custom keywords and allow up to 150 url redirects each month. They also offer 100 on-the-fly link shortening domains monthly through their paid plans ($7/month).

It's a great tool but it can be a bit tricky on first installation because the default settings only allow localhost connection to your server.

In this tutorial, I'm going to walk you through the process of installing YOURLS on a VPS or paid hosting account. You can use either LAMP or LEMP stack to run the scripts. If you're using Windows Server 2008 R2, just follow along with me and substitute all commands for cmd where you see it in the text below.

First thing that we need to do is head over to yourl . s website and download their install script . Once it's downloaded, rename the word "install" so it's not easily identified as malware (as most hackers know this trick). Right-click on install.php , select rename, and give it another name like createadmin . This way if anyone were to take a look at your files they wouldn't know what it was and would be less likely to mess with it.

After you rename the file we'll need to upload the script to our server . I'm going to use WinSCP for this tutorial, but there are other FTP clients available. If you're using FileZilla just follow along with me and substitute all commands for FileZilla where you see it in the text below.

Now that we have our script uploaded, connect into your server's root directory through SSH or FTP client (I'm using Putty). Now move the file from wherever you put it onto your sever's main webserver folder . It should be in on a paid account in the public HTML folder (i.e., /home/demo/ and in a LAMP stack it should go into

Once you move the file we'll need to rename it again so hackers won't be able to identify what it is . Right-click on createadmin.php , select rename, and give it another name like paidurl . This way if anyone were to take a look at your files they wouldn't know what it was and would be less likely to mess with it.

Now open up paidurl that you just moved onto your server . You'll see that there are quite a few things that need changed before you can run paid url shortener through YOURLS on your paid account.

Once paidurl is open we'll need to change the following three things: your settings, database and domain.

On line 4 you'll see: $database_type = 'mysqli'; . You can replace this with either mysqli or pgsql depending on which one your hosting provider uses. On line 16 you need to change YOURLS_DB_HOST from localhost to your server's hostname/IP address (i.e., www . paidurls . com). And on line 24 you need to remove all instances of localhost .

Next, on line 30 you'll see that YOURLS is configured to store a lot of its files in public HTML directory, but paid accounts use the public_html directory. To fix this,

Now that paid url shortener is configured correctly, we can move on to creating a database for paidurls . Fortunately paidurl has an install script which will make the process even easier for us .

Again, I'm using Win for this tutorial but you can use any FTP client to upload paidurl/install.php . Once paid url shortener is uploaded open paidurls.create.sql through your paid host's MySQL management panel , which should be found under the Databases tab within cPanel or whatever control panel your paid host uses. Now just fill out the information that you see in paidurls . create section of paidurls . create.sql .

Now move paidurls . create to your main webservers folder , which for me was /home/demo so it should be located at /home/demo/paidurls/.create once you are done, and rename it to paid_table_creation_script . This way if anyone were to take a look at your paid host's files they wouldn't know what it was and would be less likely to mess with it.

Now we need to make paidurls . create run as a PHP script, so we'll need to edit paid url shortener's YOURLS.php file to include system("perl paid_table_creation_script"); . It should now look like the image below:

Finally , we just need to open paidurls . create.sql through your paid host's MySQL management panel , which should be found under the Databases tab within cPanel or whatever control panel your paid host uses and import paid_table_creation_script as if you were importing any other database table. Once paid url short