Hello,

I know that some web sites offer a service to shorten
long url. It is very useful when your site is hosted
by your Internet provider for example, and that you
have a long url. Or when you want to send it in an
e-mail.
tinyurl.com does that for example.
The principle is that you enter your long url in their
form and it gives you a shorten url like
tinyurl.com/h4599

I was wondering how it works. I think it must use PHP.

I see two possibilities.
First is that the site creates an html page with a
redirect header, like <META HTTP-EQUIV="REFRESH"
CONTENT="0;URL=...
But then it would mean that the site needs to host
thousands of web pages for all its users.
The second choice is to create a simple database with
two fields. The first is the long url and the second
is the shorten. So, when someone try tinyurl.com/h4599
it sends it to the real site.

But is it possible for a web site to capture all the
possible urls that it has created then compare it to
its database?
Because it has not created a webpage "h4599.html" for
example, then the site should show a 404 page.

Thanks for your help.


        

        
                
Vous manquez d’espace pour stocker vos mails ? 
Yahoo! Mail vous offre GRATUITEMENT 100 Mo !
Créez votre Yahoo! Mail sur http://fr.benefits.yahoo.com/

Le nouveau Yahoo! Messenger est arrivé ! Découvrez toutes les nouveautés pour 
dialoguer instantanément avec vos amis. A télécharger gratuitement sur 
http://fr.messenger.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to