You are here: Re: Page redirect problem « All PHP « IT news, forums, messages
Re: Page redirect problem

Posted by J.O. Aho on 01/11/06 14:50

Pete wrote:
> I would ro remove all characters after "&" in a url so
> http://www.mydomain.com/test.php?id=1&sid=2 is
> redirected to http://www.mydomain.com/test.php?id=1
>
> <?php
> $pos = strpos($_SERVER['REQUEST_URI'], "&");
> $new_url = "http://www.mydomain.com".substr($_SERVER['REQUEST_URI'], 0,
> $pos);
> // print $new_url;
> header("Location: $new_url");
> ?>
>
> But it doesn't work. All requests are redirected to http://www.mydomain.com
>
> What is wrong?
>
>
<?PHP
$arguments = explode('&',$_SERVER['REQUEST_URI']);
$new_url = "http://www.mydomain.com".$arguments[0];
header("Location: $new_url");
?>

This one works for me with Apache, if that don't work for you, then the
webserver most likely is not configured correctly.


//Aho

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация