PHP and Redirect

Discussion in 'PHP' started by inatmo, Mar 28, 2008.

  1. #1
    Hi
    Can you please help.
    Does this code
    header ("Location: http://www.somepage.com/");
    will send http referer url?
    Thanks
     
    inatmo, Mar 28, 2008 IP
  2. Ikki

    Ikki Peon

    Messages:
    474
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi there,

    The header() function will send headers to the browser. In your case, header("location:http://www.somewhere.com") will tell the browser to redirect your visitor to a new location.

    The landing page (the page you're redirecting people to) can tell where the visitor came from by using this super variable: $_SERVER['HTTP_REFERER']. For example:
    $referrer = $_SERVER['HTTP_REFERER'];
    echo "This visitor came from $referrer";
    PHP:
     
    Ikki, Mar 28, 2008 IP
  3. inatmo

    inatmo Active Member

    Messages:
    338
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Thanks
    It is exist! :D
     
    inatmo, Mar 28, 2008 IP
  4. Ikki

    Ikki Peon

    Messages:
    474
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Don't worry ;) I'm glad it helped you
     
    Ikki, Mar 28, 2008 IP