A TinyURL PHP page
Written by Harry Fairhead   
Sunday, 05 July 2009
Article Index
A TinyURL PHP page
Building the new URL

Sometimes you just need a much shorter URL, often called a "TinyURL" to send to someone in an email or quote over the phone. The advantages of a tiny URL aren't confined to writing it down or spelling it out, even a human readable URL often spills over more than one line in an email making it unclickable unless the user copies and pastes the fragments back together.

To create a tiny URL in a general setting you have to keep a table relating the tiny URL to the full URL and you have to manually set up each URL that you want to use. That is, you have to specify the tiny URL: http://mysite/tiny and the URL it is to be mapped to e.g. http://mysite/long. However, in the case of any website that uses a database it is often possible to do the job automatically using the fact that every major component of the website is stored in the database under a unique ID number. For example, in the case of Joomla every article has a unique ID number that can be used to specify that it should be displayed in a web page. Joomla's typical URLs, even its Search Engine Optimised (SEO) URLs, are longer than they really need to be because they specify lots of additional features. So the idea is that these can be made tiny by simply mapping the article ID to an expanded ID based URL.


Last Updated ( Monday, 06 July 2009 )