Re: IIS \ Apache and header(location: errors

From: Date: Sat, 19 Oct 2002 00:15:04 +0000
Subject: Re: IIS \ Apache and header(location: errors
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-16444@lists.php.net to get a copy of this message
Bob, To redirect I use a simple little function which doesn`t need URLEncode and works thru Apache without drama although it is a bit of a "cheat" since it is sending a small chunk of client side script... function redirect($url){ echo "<script>window.location.replace(\"".$url."\")</script>"; } (put this near the top of your code or stick it in an "included" library of frequently used functions) in your PHP code you would use it thus ... if ($_POST["txtPassword"] == "" ) { redirect("logon.php?params=".$params."&info=I need a password"); } There are undoubtedly several good reasons why a purist wouldn`t do it that way but hey - it works. Cheers CD ----- Original Message ----- From: "BOb Pardoe" <bob.pardoe@hayslogistics.co.uk> To: <php-windows@lists.php.net> Sent: Saturday, October 19, 2002 2:11 AM Subject: [PHP-WIN] IIS \ Apache and header(location: errors > I am trying to execute the following redirection on a web page if the error > condition is true > > if ($_POST["txtPassword"] == "" ) { > header ("Location : > http://".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"])."/"."errors.php > ?Err=".URLEncode("LogOn -002")."&SrcLocn=".URLEncode("LogOn.php")."&Info=".U > RLEncode("The Password Cannot Be > > Empty")."&RtnTo=".URLEncode("LogOn.php")."&Params=".URLEncode($Params)); > exit; > } > > The text resolves to > > http://localhost/public/errors.php?Err=LogOn+-+002&SrcLocn=LogOn.php&Info=Th > e+Password+Cannot+Be+Empty&RtnTo=LogOn.php&Params= > > which is correct. > > I am running on XP SP1 > > My problem is that this works fine on IIS 5.0 but fails on Apache 1.3.26 and > Apache 2.0.39 > > No errors are logged in php, apache or event logs. > > I just get a blank page, viewing this source it is the index.php page (the > frameset definitions) > > Ideas ? > > Any help appreciated. > > Thanks > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.windows (#16444) next »