301 redirect of PHP with $_GET variable

Discussion in 'Apache' started by aeboi80, Jul 30, 2011.

  1. #1
    We plan to move our site which is myolddomain.com/index.php?id=something to newdomain.com/aff/index.php?id=something

    Is there a way to do 301 redirect with a wildcard which would keep the $_GET variable in the URL intact?

    Thank you,

    Chad
     
    aeboi80, Jul 30, 2011 IP
  2. expertmac

    expertmac Member

    Messages:
    78
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    46
    #2
    Try this:

    
    <?
    $url = $_GET['id'];
    @header("Location:http://newdomain.com/aff/index.php?id=$url");
    
    ?>
    
    HTML:
     
    expertmac, Aug 12, 2011 IP