What is YOURLS?
What is YOURLS you might ask. And why should you care that it’s easier to install?
YOURLS stands for Your Own URL Shortener. It’s a standalone link shortener that you install on a self-hosted website.
YOURLS is what I use to create and track my evergreen links.
It used to be that in order to install YOURLS you had to be able to create a MySQL database and do a bit of other technical stuff. Or you could hire someone to install it for you. Because I can never do anything the easy way, I handled the original install myself, while on vacation, even though I’d never done anything quite like that before.
Yeah, there were a few hair-pulling moments. But I did it.
These days, as long as your web host has cPanel and the Softaculous app installer, it’s super easy to install YOURLS.
However, there’s one piece missing from the install that I think is critical to authors. I’ll tell you how to fix that at the end of this post.
Advantages of YOURLS
First, with YOURLS you get self-branded URLs for free. Because you install it on your own site, your links will be of the general format yourwebsite.com/shorturl. Some online link shorteners will give you self-branded URLs, but you have to pay for them. Why does this matter? In today's era of online security threats, many people are wary of clicking on short links such as bit.ly.
Second, YOURLS isn’t dependent on the good graces of WordPress or an online link shortening service. So you’re in control. If WordPress suddenly disappears, all of your YOURLS links will still work. Plus, if you buy a short domain name and install YOURLS on that site, then even if your main website becomes corrupted your YOURLS links won’t be affected.
Finally, YOURLS has great metrics. You’ll be able to see clicks by location, date, and referrer (Twitter, Facebook, etc.). Also, if you install plugins, you can increase the functionality. More on YOURLS plugins in the next post in this series.
Before You Install
Here’s what you need to do before you install YOURLS:
Let's Start the Install
Log in to your web host’s cPanel.
Click on Softaculous.
In the search box, start typing YOURLS. It will likely auto-populate before you’re done. When you see YOURLS appear in the list below the search box, click on it.
The YOURLS page opens. You can click on the tabs to get more information about YOURLS and to see screenshots.
Under the blue Install Now button, check that you have the required amount of space to install.
If yes, click Install Now.
If no, then you need to talk to your web host to see if you can get more space.
Now you're at the YOURLS setup page.
Choose Protocol: Tell it if your site is https or http.
In Directory: If YOURLS is the only thing you’re installing on this website, then you don’t need a directory. Delete yourls in the box provided.
HOWEVER, if you’re installing YOURLS on the same domain as a WordPress site, then you need a directory. That’s because there can only be one htaccess file in the root directory and both WordPress and YOURLS have their own htaccess files. In order to keep the links you'll be creating as short as possible, delete yourls as the name of the directory and instead use something short, like the letter u.
Site Name: This can be whatever you want.
Admin Username: This is the name you'll use when logging in to the YOURLS admin dashboard.
Admin Password: YOURLS will let you know if the password you choose is strong enough.
First Name: Your first name. Or if you're going to have an assistant manage this, their first name.
Last Name: Your last name. Or if you're going to have an assistant manage this, their last name.
Admin Email: The email address where you want to receive admin notices. This box should by default show the email address you use for your admin account with your web host.
Expand the screen to see the Advanced Options.
You can leave everything here as is. However, I suggest ticking the box for Auto Upgrade, so you don’t have to worry about installing YOURLS updates yourself.
Provide an email address in the box at the bottom if you want the installation instructions emailed to yourself or an assistant.
Complete the Install
Click the blue Install button.
Wait for the progress bar to finish.
You’ll get a Congratulations message with a link to your YOURLS admin panel.
It even gives you the option to Tweet about it. Go ahead, you rocked this, brag about it!
Now for the Customization
Here’s the part where I tell you what I think is missing from the install.
As a writer, I often want to create multiple short links that point to the same long URL. For example, for tracking purposes, I might want to put a link to my latest book in the back of ebook 1, in the back of ebook 2, on my website, and on some printed marketing materials. If I want to track clicks for those separately, I need to create a separate short URL for each location.
The default setting for YOURLS is to allow only one short link per long URL.
File Manager to the Rescue!
Don’t worry. A quick tweak will resolve this.
Go to your main cPanel page.
Choose File Manager.
If you installed YOURLS directly into the root folder, go to public_html/user.
If you installed YOURLS in a directory, go to public_html/name of YOURLS directory/user.
Look for the config.php file.
Click on it to highlight it.
Click the edit button to open the file in your browser.
If you get a warning message, read it. It’s probably a warning about how you can screw things up if you’re messing with the encoding or the language. You’re not. So you’re okay to dismiss this message.
Once the config.php file is open, look for this line:
define( ‘YOURLS_UNIQUE_URLS , true );
Change true to false. Make sure you keep the spacing exactly the same around the word.
Click on the Save changes button in the upper right.
Then click Close.
Pat yourself on the back. That wasn’t so hard, was it?
YOURLS is a standalone URL shortener that gives you self-branding, control over your data, and great metrics. It’s worth the effort to install if you plan on creating a lot of evergreen links or need to manage a lot of short URLs.
In the Next Post in This Series
I’ll explain how plugins extend the functionality of YOURLS and how you can install them using either cPanel’s File Manager or an FTP client such as FileZilla.
Until then, Happy Writing!