How To Turn A Personal Domain Into Your Own Personalized Link Shortener

Simon Slangen 23-04-2012

Link shorteners are a dime a dozen. Even Google and StumbleUpon have joined the fray, because a shortened URL doesn’t just look good. They also go a long way to improving the usability of links. Even if you’re not limited by 140 characters, shortened links are easier to remember, and it keep your shares, and those of your readers, uncluttered.


If you have your own website, you can get by with using a popular URL shortener like [NO LONGER WORKS] TinyURL or However, with your own domain, there’s little reason not to set up your very own URL shortener. Hosting your own URL shortener has a number of advantages for any site owner. Apart from the added control, it’s also a matter of branding. You’re constantly building on the image of your site, and your own URL’s make up a nifty part of that image. It adds recognizability and helps non-frequenters remember the name of your site.

These self-hosted shorteners fall into two broad categories. With a private shortener, only the owner of the website is able to create new short URL’s – this is ideal for a content-based system, like a blog, a forum, or a company website. Whether a gimmick, or an integral part of your website, everyone can use a public shortener to compress additional URL’s, effectively creating your own TinyURL or lookalike.


In both the cases outlined above, YOURLS is your go-to guy. This set of PHP scripts allows you to quickly and easily install a customizable URL shortener on your website, complete with bookmarklets and WordPress integration. We’ll walk you through the process.

Server Requirements

We will assume you already have your own server space. If not, take a look at James’ explanation on The Various Forms Of Website Hosting The Various Forms Of Website Hosting Explained [Technology Explained] Read More , the results of our Poll: Which Is The Best Budget Web Host?, or Danny’s guide on How To Set Up An Apache Web Server In 3 Easy Steps How To Set Up An Apache Web Server In 3 Easy Steps Whatever the reason is, you may at some point want to get a web server going. Whether you want to give yourself remote access to certain pages or services, you want to get a community... Read More  for a locally hosted server.

When you’re picking a potential candidate, keep these YOURLS server requirements in mind:

  • A server with mod_rewrite enabled.
  • PHP support (version 4.3 or higher).
  • MySQL database support (version 4.1 or higher).
For more, and current technical information, go to the YOURLS FAQ.

Step 1: Download & Extract YOURLS

Download the latest version of YOURLS and extract it in a place you can easily reach on your computer.

link shortener

In this folder, copy ‘/includes/config-sample.php’ to ‘/user/config.php‘.

Step Two: Fill Out Your Server Details

MySQL will need a database to work. If your server meets the requirements, you can usually create one in your host’s administration panel with a few clicks of the mouse. This is also where you’ll be able to find the database name, URL and access credentials.


The server host field can usually remain at ‘localhost‘, unless otherwise specified by your web host. If you’re stuck, look at your host’s help files, or contact support.

free link shortener

You’ll also need the URL of your website. Mind you, this is not necessarily your root domain name. If you’ve already installed something on your root domain (like a blog), you’ll have to put YOURLS in a sub-folder. The path of this sub-folder will determine the URL of your YOURLS site. For instance, if you install YOURLS in a folder /s, the URL of your YOURLS site would be .

Open the file you’ve just copied ( /user/config.php ), in your favorite text or code editor. You can use Notepad or TextEdit on Windows or Mac OS X respectively. Now, replace the corresponding fields in this file with the database credentials and the URL you just found and hit save. Scrolling down, you can find a batch of other options in this configuration file. You can customize these to your liking, or stay with the default configuration.


Step Three: Upload The Files To Your Server

Next, we’ll upload the unzipped YOURLS files to your server. You can use an FTP client (again, getting the FTP credentials from your web host), or use your web host’s online file manager to do so. You’ll have to upload these files to the folder you specified as the YOURLS installation URL in the previous step. This will likely be in ‘/www/your_folder‘ or ‘/public_html/your_folder‘.

You can now point your web browser of choice to to finish the configuration.

Step Four: WordPress Integration & Other Plugins (Optional)

If you’re using YOURLS in conjunction with WordPress, the fun doesn’t have to stop there. YOURLS has released a WordPress plugin that allows you to integrate your URL shortener with your blog. Using this plugin, you can automatically shorten the links of your newly published blog posts, and even post them directly to twitter.

link shortener


However, you aren’t limited to WordPress. On the YOURLS site, you’ll be find an ever growing list of plugins. You can use these to integrate with Google Analytics, Tumblr, or automatically generate QR codes, just to name a few.

Where are you going to use your personal URL shortener, and how? Let us know in the comments below!

Related topics: Domain Name, URL Shortener, Webmaster Tools.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Patrick Jackson
    September 6, 2012 at 11:14 am

    A good one. Just read it recently.

  2. sneakily1
    April 24, 2012 at 11:24 am

    I've used yourls on a couple of my sites for over a year now, and it's amazing. one thing to keep in mind if you do use this, and allow the public to use it... you might want to check your database once or twice a month to make sure spammers aren't using your url shortener for their own gain. Fortunately, the admin panel of yourls makes it easy to spot spammers (see a url that has a crap-ton more hits than any others you've posted?) and also collects ip addresses in case you need to ban abusers. There's nothing worse than having someone abuse your brand and suffering because of their greed. Just a heads up. Yourls is something I highly recommend though for anyone who owns their own domain... a must have!

    • Simon Slangen
      April 24, 2012 at 3:52 pm

      Thanks for your comment. If you're worried about spammers, a good YOURLS plug-in is Abuse Desk for YOURLS. It uses Google Safe Browsing to weed out most of the spam links. Also, if you've spotted a spammer in the admin panel, you can use the Mass Remove Link plug-in to take down all links originating from a single IP address.

      Extendability like this is what makes me a YOURLS fanboy. :-)

  3. Sean O
    April 23, 2012 at 4:51 pm

    Nice YOURLS tutorial.

    For those who want to take a crack at writing their own URL shortener, I wrote a primer a while back:

    • Simon Slangen
      April 24, 2012 at 3:48 pm

      Cool! Thanks for the tip!

  4. faisal khan
    April 23, 2012 at 3:16 am

    nice.. but since i am a blogger fan.. so let's see if it works for blogger platform or not?

    • Simon Slangen
      April 24, 2012 at 3:56 pm

      Hi Faisal,

      I don't think there are any Blogger integration plug-ins. Because Blogger is hosted by Google, there's no obvious way to implement YOURLS on the same server. You could always install YOURLS on a separate domain and use it to shorten your blogger links yourself, though.

  5. Johann
    April 23, 2012 at 1:53 am

    Or if you're already using Google For Your Domain (email etc) just enable the Link Shortener Lab and define a CNAME to point to it such as

    And if you're not using Google For You Domain, here's another good reason to I guess...

    • Simon Slangen
      April 24, 2012 at 3:58 pm

      Thanks, I didn't know about that. I guess you've got most everything you need already if you use Google for your domain. :-)