An URL Shortener isn’t a particularly difficult piece of code to write, nor implement. Basically it is nothing more than creating a short unique string and associating it with a full URL, with some redirect code written to handle any incoming short code links.
That said, just because it’s easy doesn’t necessarily mean that I feel like writing my own version right now, which is why it was super useful to come across Brian Cray’s nice, simple and very portable PHP-URL-Shortener project (on GitHub) that makes it a snap to get a quick and dirty URL shortener system running on one of your hosted domains.
Setup is little more than creating a database and user account in which to store the links, upload the provided files, edit the config file, and rename the .htaccess file. Literally a five minute job!
You can shorten links both manually (by browsing to the location you installed to) or programmatically via the supplied API.
Nifty.
Related Link: https://github.com/briancray/PHP-URL-Shortener