 Reviews:
·AT&T U-Verse
| reply to theedj
Re: Redirect with additional variablesWhy not use the KIS approach?
<?php
$requestURI = $_SERVER["REQUEST_URI"];
if(strpos($requestURI,'?')===false)
$requestURI = $requestURI."?";
else
$requestURI = $requestURI."&";
$requestURI = $requestURI."s=stuff";
header( 'Location: http://siteb.com'.$requestURI ) ;
?>
|
|
 cdruGo ColtsPremium,MVM join:2003-05-14 Fort Wayne, IN kudos:7 | said by cowboyro:Why not use the KIS approach? Because mod_rewrite can accomplish the same thing in fewer lines without having to run it through PHP. |
|
 Reviews:
·AT&T U-Verse
| said by cdru:said by cowboyro:Why not use the KIS approach? Because mod_rewrite can accomplish the same thing in fewer lines without having to run it through PHP. If number of lines is an issue then squeeze it to one line:
<?php header( "Location: http://siteb.com". $_SERVER["REQUEST_URI"] . (strpos($_SERVER["REQUEST_URI"],'?')===false,"?","&") . "s=stuff") ?> ;
However it offers more granular control on how the redirect will be done and can be ported directly to different platforms (say IIS) or even to a different host that may not have mod_rewrite enabled. |
|