1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.
  2. Better Analytics for WordPress Get It Free

Redirect with PHP and Set Referrer to Redirect Page

Discussion in 'PHP' started by skanxalot, Jan 10, 2008.

  1. #1
    Hi everybody,

    I have a question, and I'm not sure there is a good answer, but I wanted to toss it out there and see. What I'm trying to do is use PHP to redirect from page A to page B, but I want the referrer in the HTTP headers to be set to page A (the page that performed the redirect).

    From what I can tell, a 301 redirect passes referrer information, but it completely bypasses the redirect page. A 302 redirect drops any referrer information. Is there any way (outside of META and Javascript redirects) to perform a PHP redirect and set the redirecting URL as the referrer?

    Thanks,
    Tyson
     
    skanxalot, Jan 10, 2008 IP
  2. mvl

    mvl Peon

    Messages:
    147
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    The referer is set by the browser but browsers are not required to send referer information. There is no way you can control this mechanism from PHP so you will have to use another method. If the redirect is within the same domain you could use a cookie mechanism. The other option is to pass it as a (urlencoded) GET parameter. In both cases you can perform the redirect by sending a Location header:

    
    ...
        header("Location: $url");
    ...
    
    Code (markup):
     
    mvl, Jan 10, 2008 IP
  3. 3dom

    3dom Peon

    Messages:
    305
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Have to print something like

    to renew referer info in browser.
     
    3dom, Jan 10, 2008 IP
  4. ghprod

    ghprod Active Member

    Messages:
    1,010
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    78
    #4
    welll, u can do it but only in Firefox with spoof url addon :)
     
    ghprod, Sep 26, 2009 IP