For a long time I’ve wanted short URLs for one of my sites. Finally I figured out a short URL, picked up the domain, and said “It would be great if I could redirect posts with this! But how?”

As it turned out, I was making a mental mountain out of a miniature molehill. I do that sometimes, get all caught up in a non-meaningful detail. This was easy, it wasn’t super complicated, and it was fast. On the scale of things where WordPress is the easiest (1) and MediaWiki is the hardest (8), this landed next to Zenphoto (4) and was about the same (3 or 4, depending on your skills). It requires more RTFM than WordPress, and I had to do some things manually.

Setting Up Your Domain

First buy the domain. This part is obvious, I hope. Since I’m on cPanel, I added my new domain as an addon domain to the master. This let me have the short domain ( let’s say) hosted off the main site, without making a separate account. If I’d wanted to map a domain, I would have parked instead of addon-ing.

To add an addon domain in cPanel:

  1. Enter the domain for the new addon domain into the New Domain Name field.
  2. Enter the main FTP username for the addon domain in the Subdomain/Ftp Username field. You can use the one you use for the mani account if you want.
  3. In the Document Root field, enter the directory that will contain the addon domain’s files.
  4. Enter the password for the addon domain into the Password field.
    • Make sure you use a secure password.
    • You can have cPanel generate a secure pasword for you using the Generate Password feature.
  5. Confirm the password in the Password (Again) field.
  6. Click Add Domain
  7. To add files to the addon domain’s home directory, click the File Manager link, or use FTP/SSH like normal people.

Once I did that, and DNS propagated, I was ready to go.

Installing the App

I decided to use Yourls for this, since my friends use it, and I know (in that internet way) the guys behind it. Hi, Ozh.

That said, their install doc was screwed up. For 1.5, it says to edit a file that apparently isn’t included in the build. That’s okay, since I just used SVN anyway. The directions are very much geeky. This is not a simple WordPress install.

What I did was first make a database domain_yourls and added my DB user account to it (I never use my domain FTP account). Then I ran an SVN checkout from googlecode to grab the files into the root of my add-on domain: svn checkout .

After that, it’s the manual editing of the config file (the sample of which is not included in the 1.5 zip) and then I went to to finish setup. I had to grab the .htaccess file sample, since mine didn’t copy down (my own fault there).

Configuring the App

Install the YOURLS: WordPress to Twitter plugin. Even if you don’t plan on using the auto-tweet function, this is the easiest way to get your URLs made. The “hard part” here is setting up a Twitter ‘app’ for the first time. If you’ve done it before, it’s not terribly hard, but with all new things, it’s scary. Ozh’s directions are painless, thankfully, and then … you’re done. And you have your own Short URLS!

What’s Missing?

Two things, and neither are YOURLS fault!

1) Twitter doesn’t know that three different URLs (, and for example) are all the same URL. That means if you use those Twitter Rewteet buttons on posts, it doesn’t show up the same way, and the ‘count’ is off.

2) There isn’t an easy way to tell Jetpack to use my short URLs instead of my site’s full one. Edited to add: By this I mean only in the ShareDaddy links. Like the ‘tweet/email/facebook’ ones. Actual shortlinks work perfectly.

I suppose a third is ‘Damn it, Twitter, stop shortening a short URL!’ but that’s a different rant.

Should you do this?

I think so, but then again, I’m weird.

Read Also…

Otto – Using YOURLS with WordPress

Rev. Voodoo – How I Set up URL Shortener With Yourls

Reader Interactions


  1. I learned about Yourls from Alex (better known as Viper007Bond) and have been thinking about giving it a try, yet what scares me is Twitter’s double shortening and inability to tell that URLs are the same. So this can probably result in incorrect tweet counts for posts, which would render the Tweet button almost useless. Thanks for sharing your experience!

    ~ Konstantin

    • The Tweet Button actually still works if people RT you with the dumb links. You still get Tweet Juice for that, most of the time.

      They’re using that for analytics and, apparently, malware cock-blocking. Which I cannot argue. I just wish they didn’t, since my URLs are often shorter than theirs. At least it fails nicely.

  2. Edited to add: By “Use the shorturl” for Jetpack, I mean only in the ShareDaddy links. Like the ‘tweet/email/facebook’ ones. Actual shortlinks work perfectly.

  3. Hi ipstenu 🙂
    What was the screwed up bit in the install doc? Can’t figure out what’s missing or what’s explained that’s wrong

  4. I’ve looked at Yourls twice now and I can’t get my head around a use case that would be worth the time and effort…maybe I’m just not thinking outside the box enough or don’t really understand why I would want such a thing for my site…

    …anyone here list some ideas for WHY one would want to use this? Benefits?

    • – for fun
      – for not being dependent on bitly or another 3rd party
      – for fun 🙂

      Seriously, just having geek fun is the #1 reason for me

    • #2 is why I did it.

      In October of 2010, Lybia (who owns all ly domains, in that way people own TLDs), shut down –

      I like short URLs, they’re easier to put on business cards and tweet etc. I like the comfort of owning mine, knowing no one but me can put ads on them. Basically for every reason I self host WordPress, I self Shorten 🙂

    • @Adam I have been using it for a little over 2 years now, and I find it useful for so many things! It has all the advantages of a standard URL shortener, plus more.

      Sure, you could always use,, or any of the other shortening services out there, but having your own allows you to “brand” your links, so people know they have been shared by you. Besides, who knows until when links will remain active. With your own domain, you are in control. 🙂

      – Since you can define custom short URLs, you can create short links that are easy to remember. Say for example the URL for WP trac. Long, takes time to type… Instead, you’d use a URL you have created only for that: (there you have my short domain 😉 )
      – You can also use it to track yourself: how many times do you check Facebook in a day? Well, set up a short link, and see for yourself at the end of the day.

      To conclude, I think you should just give it a try, and see how it goes. Am I weird too? 😉

    • All good reasons, and thank you for expanding:)

      This brings up another question then…I’m currently using Simple URLs plugin to manage some affiliate URLs. If I were to utilize Yourls for this domain, I wonder how that would affect those?

      I suspect the answer will be that it won’t, because Ozh…you are a great plugin coder and probably already considered something like this:)

      Either that or I just need to shut up and go try it out;)

      So, thanks to Ipstenu for this post, thanks to Ozh for Yourls, and thanks to Jeremy for giving some additional food for thought!

      Most appreciated all!

  5. Great writeup!

    I’ve setup several YOURLS installs in the last couple of years and it works great for what I need it for. Granted, I hardly need my own shortener for my not-oft-updated blog but whatever, it’s fun to send people to links. Frankly, I think I spent more time and energy coming up with an available short url than I did setting up the system to generate them. A couple things I love about shorturls coming from a more social background: 1) Being able to shorten links by prefixing them with my shorturl, 2) Being able to hook the api into TweetDeck or other social managers so I can shorten with my own address on the fly.

  6. Ooh, good write up! Is the write up I did back in May when I set up I had tried Google shortlinks, which I guess can only be private, so that didn’t work. Then I had tried phurl because I hadn’t known about Yourls. Luckily I hadn’t made too many shortlinks on phurl. I redirected all of them, and set up yourls. I use it with Otto’s bastardized WP plugin on all my sites and it is superfly! I think personal shortlinks are great nerd fun, and also great branding. I dunno if anyone noticed…. I have a sort of Voodoo theme running through all my sites (long-ish story…. no, I am not a Voodoo priest or anything…. I am however, Canadian). The short URL keeps the branding theme running. Great write-up Ipstenu, A little more step by step/technical than mine…. so if you don’t mind, I’ll link people here from VoodooPress to check out your article in conjunction with mine!

    • I wrote it because my GoogleFu failed me trying to find a write up.

      Which of course meant I later found your article AND Ottos. Both of which I’m gonna link to in the post 🙂

    • How in the crap have I never linked Otto’s article? wow…. I’m adding that one to my post too, thanks!

  7. I still use my modified YOURLS plugin which removes the Twitter bits, BTW. Works well.

  8. For those wondering, the details of the site that’s using all this is here:

  9. I love YOURLS – I use it to measure the clicks on any given link and I keep my data in house. I’m also using the YOURLS: WordPress to Twitter plugin by Ozh and they are awesome tools for measuring goals and conversions. There are some things I’d like to see improved but I haven’t even had time to contribute. Either way, Ozh, kudos on the work!

%d bloggers like this: