You probably know tinyurl, bit.ly, is.gd and the list is too long of URL shortener. Florian Anderiasch wrote his own URL Shortener in PHP and released code under BSD license. The code is just 259 lines of php code require PHP 5.2+ and PDO with SQLite enabled.

As some people already wrote, and I feel no different here, broken links are baaad, mkay? So the easiest way would be to get a short domain for yourself and run your own url shortener. I am happy enough to have secured myself a not yet publicly announced 3-char .de domain which I’m planning to use for that. This and being bored for 2h led me to roll out my own shortening service

URL Shortener

Florian’s shortcode can :

  • http://example.org/_[uniqueid] redirects to what you saved.
  • http://example.org/_[uniqueid]_ shows a preview
  • So I have “xxx.de/_ab” – as low as 10 chars for an url (excluding http://), that’s not less than a bit.ly url (currently at 5+ chars after the /) and I can still put normal content (not starting with a “_”) on the domain – fair deal I think
  • there’s a bookmarklet for easy saving, either provide the [uniqueid] or let it be generated automatically
  • it’s not meant as a public shortening service, so probably some basic auth has to be added

Advanced URL Shortener

If you are looking for something more advanced there is also Phurl, Jonathan Snook have also a nice howto build a url shortener using cake PHP. I think someone should better focus on a unified API for all these Shorteners instead of creating more new ones.