301 multiple redirect with dynamic urls

Discussion in 'Search Engine Optimization' started by tdd1984, Jun 9, 2007.

  1. #1
    tdd1984, Jun 9, 2007 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You would need to set a cookie before doing the 301 redirect. Let me know if you want the code.....
     
    mad4, Jun 9, 2007 IP
  3. tdd1984

    tdd1984 Well-Known Member

    Messages:
    2,357
    Likes Received:
    42
    Best Answers:
    0
    Trophy Points:
    150
    #3
    most certainly :)
     
    tdd1984, Jun 9, 2007 IP
  4. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #4
    First set a cookie then redirect:
    
    $userid=$_GET["userid"];
     setcookie("userid", $userid, time()+3600, "/", ".domain.com", 0); //1 hour cookie
    header("HTTP/1.1 301 Moved Permanently"); 
    header("Location: http://www.domain.com/static.php"); 
    exit();
    
    Code (markup):
    Now you can check the cookie:
    if (isset($_COOKIE["userid"])) {
    //do something
        } 
        else 
        {
    // do something else
    }
    Code (markup):
     
    mad4, Jun 9, 2007 IP