Need some quick help with a htaccess redirect

Discussion in 'Commission Junction' started by vetting, Dec 28, 2007.

  1. #1
    vetting, Dec 28, 2007 IP
  2. hanji

    hanji Peon

    Messages:
    612
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I'm not sure if you'll be able to do that with redirect in .htaccess... but you could do something like this with rewrite and a PHP page.

    .htaccess...
    RewriteEngine On
    RewriteRule ?itemID=([0-9]+) go.php?itemID=$1 [QSA,L]
    Code (markup):
    So this will look for itemID in the url, and redirect to a php page, called go.php
    This php page would then take the variable and then redirect via header().

    go.php
    <?
    if(isset($_GET['itemID'])){
    	header("Location:http://www.othersite.com/".$_GET['itemID']."?refid=store");exit();
    }
    ?>
    PHP:
    Seems like another option is to use the default PHP page and handle redirect on itemID condition. I'm assuming this is index.php?itemID=65165654654, in that case you could add 'go.php' snippet to that page, and scrap the rewrite handling all together. I might be misunderstanding.. so correct me if I'm wrong.

    hanji
     
    hanji, Dec 28, 2007 IP