How does work shorten url services?
| From: | Henri Marc | Date: | Sat, 18 Sep 2004 08:49:34 +0000 |
| Subject: | How does work shorten url services? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-197090@lists.php.net to get a copy of this message | ||
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 despace 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