republican-creole
site Search:


 
    All Forums Hot Topics Gallery






how-to block ads


 
Search Topic:
Share Topic
Posting?
Post a:
Post a:
Links: ·How To Get Noticed ·Web Monks FAQ ·Webhosting FAQ ·Posting Code ·How To Post ·Webhosting forum
AuthorAll Replies


cowboyro

join:2000-10-11
Shelton, CT
Reviews:
·AT&T U-Verse

reply to theedj

Re: Redirect with additional variables

Why 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 ) ;
?>
 


cdru
Go Colts
Premium,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.


cowboyro

join:2000-10-11
Shelton, CT
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.

Sunday, 19-May 02:36:09 Terms of Use & Privacy | feedback | contact | Hosting by nac.net - DSL,Hosting & Co-lo
over 13.5 years online © 1999-2013 dslreports.com.
Most commented news this week
Hot Topics