Re: Splitting up long URLs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux