Blogging Tutorials

How to Create Your Own URL Shortener For Free: Step by Step Guide

Welcome back. You are reading How to Create Your Own URL Shortener for Free. Now let’s move ahead on the second part of the guide.

How to Use YOURLS to Shorten URLs?

Now that your very own URL shortener is up and running, familiarize yourself with the admin interface.

Log in to the YOURLS admin interface by following the link shown on screen and using the username and password you chose.


Log in to YOURLS Interface

Once you log in, you will see how the admin interface looks like. You will notice three short links already created to give you idea about how short links will work on your setup.

For example, if you follow the first link (ozh), you will be taken to the website of Ozh Richard -the awesome developer and creator of YOURLS.

YOURLS Admin Interface

From this interface, you can start creating short links. To do so, enter a long URL in Enter the URL area. Now if you wish this URL to have a specific text, then enter it under Custom short URL. This is used when you want to enter a product/company name.

As an example, I will add my Twitter URL https://twitter.com/parvezish under Enter the URL and twitter under Custom short URL. This will make my link to look like techstuffer.com/out/twitter and if someone follows this, it will take them to my Twitter profile.

In some instance where you don’t need a URL to have its own name, you can leave Custom short URL area empty.

Now go ahead and test out a few links. See if things are working out as intended.

Optional: Set Short Links to Have Random Characters Automatically

If you have noticed, your short links without Custom short URL begin with 1, 2, 3 etc. This is not an ideal way of sharing links. Your short links should carry longer and random characters at the end. So every time a new link is added either manually or automatically, they will look like techstuffer.com/out/xydvsd.

If you wish to do so, you will need to install a plugin in YOURLS. Just like plugins in WordPress, YOURLS plugins help enhance its functionality. You can have a look at all YOURLS Plugins on its Github page.

Okay, now we will download the Random Keywords plugin from the Github page. Find Random Keywords, click on it and click download as a Zip. This will download a small Zip file on your device.

Download Random Keywords Generator

Now, upload the random-keywords-master.zip file to your server under /server/out/user/plugins and extract it there. Replace out with whatever term you used before.

Install Random Keywords Generator

Go to the YOURLS admin interface > Manage Plugins and activate the Random Keywords plugin.

That’s it. From now on, your short links will have random characters instead of numbers like 1, 2, 3.

Configure Your URL Shortener to Work with WordPress

Of course going to admin interface and creating new links every time a new article is published on your blog is time consuming. This is why you should configure the link shortener you just created to work with WordPress. After which, a short link will be generated automatically each time a new article is published.

For this, you will need to install YOURLS Link Creator plugin in WordPress. After you install and activate this plugin, you can configure it using YOURLS API.

Go to YOURLS admin interface > Tools. Find your secret signature token under Secure passwordless API call and copy it.

Go to WordPress dashboard > Settings > YOURLS Settings. Ebter your YOURLS installation URL and the secret key you copied in respective fields. I will enter the URL as http://techstuffer.com/out.

Also check Auto generate links, Scheduled Content and Use YOURLS for shortlink options. If you have custom post types (like WooCommerce products) and you want them to have their shortlinks as well, then check the Include Custom Post Types and select which custom post types will have their shortlinks automatically created.

Click Save Changes.

Configure YOURLS Plugin WordPress

Now every time a post is published on your blog, a new short link will be automatically generated. You can find the short link to an article under Edit Post area (after you click Publish) and in the YOURLS admin interface. You can copy and share this link anywhere you want.

How to Create Your Own URL Shortener: Summary

In this step by step guide, you learned how to create your own URL shortener for free. We used YOURLS, an open-source and free PHP script as back end.

We also configured WordPress to work with YOURLS so every time you post a new article, a new short link will be generated automatically.

That’s it folks. You have just created your own URL shortener -which was not only easy, it was completely free! You can create as many URLs you wish and share them anywhere.

This was Parvez on techstuffer.com and you were reading How to How to Create Your Own URL Shortener for Free. I hope you found this article useful. If you have questions, feel free to ask. Also let me know if I have missed something.

Support Me: If this article/tutorial helped you today, please consider supporting me and help me run techstuffer.com without ads that track you.
EasyWP Cheap WordPress Hosting by Namecheap

Written By

Parvez Shaikh

I started blogging as a teenage hobby and decided to continue it after leaving my life as a System Admin behind. Now I juggle between being a tech blogger and a travel blogger/photographer. On Tech Stuffer, I share my views and knowledge about digital privacy, technology, gadgets, blogging etc. among other things.

1 Comment

Leave a Comment