I am tired of using external URL shorteners, my favorite "tr.im" went out of business. I know there are some that will do reporting for me, but I want to run my own, so I can see the usage myself, for my own, not for public use.

Are there software packages that serve this niche? I don't necessarily want to allow third parties to use it, but I would like it to integrate into other software, like some Twitter tools or WordPress, if that's a possibility rather than always having to go to the site to log in.

What are my options for tools for running my own shortener? Assume I've done the easy part, buying a short domain.

And any other comments or tips on what makes a good shortener are welcome, but optional.

  • Just curious--what advantages do you see in running your own URL shortener versus using a 301 shortener service? As mentioned, it's not hard to do, though integration with 3rd party services will take time. While you'd definitely have much more control over things, I can't really think of any tangible benefits off the top of my head. Nov 18, 2010 at 18:21
  • How about disadvantages? tr.im was quite good, with metrics and flexibility, and went out of business. *.ly shorteners are good, but depend on the goodwill of the Libyan government. External sites may share or sell link data with 3rd parties. By running my own, I avoid these pitfalls. Do those issues help you understand where I'm coming from?
    – artlung
    Nov 18, 2010 at 18:26
  • I think you got unlucky with tr.im, and if you got your own .ly domain it would depend on the goodwill of the Libyan government as well. But if you're worried about service availability, goo.gl is a safe bet, as Google is likely to outlive all of us. Though if Twitter is using Bit.ly, I don't think the rest of us need to be worried about it. Though it does occur to me that if you have your own shortener, you could use short slugs (e.g. goo.gl/superbowl, bit.ly/popedies, etc.) instead of arbitrary strings. Nov 19, 2010 at 2:45

4 Answers 4


Setting up a URL shortener isn't really that hard if it is for your use only. In order to integrate with with Twitter and WordPress you will have to develop you own API and plugins and that is the difficult or at least time consuming part. I think the basic steps would be.

  1. Buy a short URL and get hosting for it.
  2. Create a redirection engine in the language of your choice. This would be a piece of code that takes a long URL and creates a short one by generating a 4-6 digit code. Since it is for your own use it could be as simple as creating a table that has the long URL and PK that is an identity column. You can then use the ID column as your short URL. Meaning if your first entry is www.example.com and your short url is ex.amp then ex.amp/1 would redirect to www.example.com.
  3. Build an API using REST or SOAP that allows you to securely add a new entry and retrieve the generated Short URL.
  4. Code the tools for Twitter, Wordpress etc.

A side note, is somewhere in step 2 you would need to create your analytics code to track all the information about who hit your links.


Just adding this for your consideration. I use this package and like it a lot > http://yourls.org/


  • Are there others you evaluated? Do you use it in concert with Twitter or WordPress or other tools? Pluses, minuses? Nice find, but more detail about why you like it would be great. Thanks!
    – artlung
    Nov 18, 2010 at 17:25

One more thing to think about is something like bit.ly Pro. You can have your own domain, but with all the speed and analytics from bit.ly.

I know that it's still relying on someone else's service, but bit.ly is probably the biggest provider on the web so if they went down, a hell of a lot of people's links would break


You can try out YOURLS. It is PHP-based and use MySQL so it should work on whatever host you're using. The nice thing is that it's GPL licensed. It looks great and the stats are very helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.