Re: How does work shorten url services?
| From: | Octavian Rasnita | Date: | Sat, 18 Sep 2004 13:08:41 +0000 |
| Subject: | Re: How does work shorten url services? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197098@lists.php.net to get a copy of this message | ||
I don't think those sites use mod_rewrite because an URl can be anything,
including:
http://www.oijoij.com/eorier/eoroeir/oier/eorij.pl?terer=wer4334&oijo=weroo&jjjjj=123#
(or much more complicated urls).
Those sites (because there are more) just put the urls in a database, and
assign an ID to each one.
Then, a program (that can be made in any language) queries the database for
the given ID, and get the long URL. Then it redirects to that URL and that's
all.
I have made such a program in perl but it is very very simple.
Teddy
----- Original Message -----
From: "Ramil Sagum" <ramil.sagum@gmail.com>
To: "Henri Marc" <mesmlamoi@yahoo.fr>
Cc: <php-general@lists.php.net>
Sent: Saturday, September 18, 2004 2:29 PM
Subject: Re: [PHP] How does work shorten url services?
On Sat, 18 Sep 2004 10:49:34 +0200 (CEST), Henri Marc
<mesmlamoi@yahoo.fr> wrote:
> Hello,
>
> 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.
>
It would use a feature of an HTTP server such as Apache -- URL rewriting
Basically, you can make rules such that urls like
http://tinyurl.com/h4599
become
http://tinyurl.com/index.php?id=h4599
you would then handle it from there.
But this is off topic :)
----
ramil
http://ramil.sagum.net
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php