How do I create a site similar to TinyURL using Apache ?

nainil
nainil used Ask the Experts™
on
Hi,

I want users to visit my site, provide a LONG URL and my site should convert it to a short URL. How do I accomplish it using Apache?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
You will need a database.  Users will enter the long url which the database will store along with a 2nd field which is a randomly generated short text.  When users click on the short link they are directed briefly to your site, the database runs quick lookup and then redirects to the actual site.

Commented:
I haven't used this script myself but does exactly what you are seeking:
http://sourceforge.net/projects/lilurl/files/lilurl/

Author

Commented:
To webjinks:

It seems the project has been out-of-sync for a while. I thought there is no need for MySQL as all of this could be done through Mod-ReWrite. Any comments?
Acronis in Gartner 2019 MQ for datacenter backup

It is an honor to be featured in Gartner 2019 Magic Quadrant for Datacenter Backup and Recovery Solutions. Gartner’s MQ sets a high standard and earning a place on their grid is a great affirmation that Acronis is delivering on our mission to protect all data, apps, and systems.

Commented:
I must admit that I simply read the description and sent link.
You will need a database because you need to store records of the long and short URL.
Technically it's not the only option short of writing each apache rule for each URL or using a text file but do not recommend anything else except for database because of ease, security and speed.

Here are 7 free scripts that look very promising.
http://www.webresourcesdepot.com/7-open-source-and-free-url-shortener-scripts-to-create-your-own/

This one was updated yesterday:
http://code.google.com/p/phurl/
Budi SantosoIT Infrastructure Manager

Commented:
The easiest one is creating script to create folder with short name input contained with index.html that redirecting to long url.
Don't forget to add captcha.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial