Re: Splitting up long URLs
| From: | Bastien Koert | Date: | Mon, 07 Jul 2008 18:19:19 +0000 |
| Subject: | Re: Splitting up long URLs | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-276391@lists.php.net to get a copy of this message | ||
On Mon, Jul 7, 2008 at 12:54 PM, tedd <tedd.sperling@gmail.com> wrote:
> At 11:57 AM -0400 7/7/08, Daniel Brown wrote:
>
>> You could display the URL's the way Google handles them:
>>
>> <?php
>>
>> function shortenURL($longURL) {
>> preg_match('/\/?[a-z0-9\.\-]+\//Ui',$longURL,$matches);
>> $shortURL = str_replace('/','',$matches[0]);
>> return $shortURL;
>> }
>>
>> $longURL = "
>>
>> http://some-SPAM-URL-011.example.com/v14gra/p3n15_pump.php?affil=43ERG3245wert002934&boo=yaa
>> !";
>>
>> echo "<a
>> href=\"".$longURL."\">".shortenURL($longURL)."</a><br
>> />\n";
>> ?>
>>
>>
> Very nice.
>
> However, there isn't a way to change what the user see's in the browser's
> url box, is there?
>
> For example, can you send a user to http://example.com/a.php,
> but they see
> http://example.com/b.php in their browser?
>
> Cheers,
>
> tedd
> --
> -------
> http://sperling.com
> http://ancientstones.com
> http://earthstones.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
apache's mod_rewrite can do that
--
Bastien
Cat, the other other white meat