« Stop Telling People to Optimize, and Start Teaching Them to Program | Main | VirtualThinking! releases TWO libraries under Creative Commons! »

Shortcode, Yet Another URL Shortener in PHP

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

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

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.

Bookmark this article at these sites
Comments
1

Thanks for the direction.

Post a comment





(Email will remain hidden)





Please enter the security code you see here




Related entries
Email to a friend
Email this article to:


Your email address:


Message (optional):