Redirecting while preserving the HTTP_REFERER

Discussion in 'Programming' started by Kendothpro, Apr 24, 2006.

  1. #1
    I'm trying to use a php page that redirects users if they come from a certain domain
    The problem is that when I redirect, the visitor's http_referrer is NOT my redirecting page, but the page before!
    What I mean is this:

    User on site A clicks on a link to site B
    Site B redirects to site C using header("Location: ...")

    You would now expect that site C would see the visitor's referrer as site B, but that is not the case, in fact site C sees the visitor coming from site A

    I hope I explained myself properly, now onto the question:
    do you know of any way for passing site B's referrer to site C?

    The header("Location:"), as I said, just passed site A's referrer, I also tried using a meta refresh tag, but it actually passes NO referrer (tested on firefox only)

    Any ideas?
     
    Kendothpro, Apr 24, 2006 IP
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,334
    Likes Received:
    2,613
    Best Answers:
    462
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    You definitely can't do it if you use the "Location" header. Try setting a meta refresh value to something other than 0.
     
    digitalpoint, Apr 24, 2006 IP
  3. Kendothpro

    Kendothpro Well-Known Member

    Messages:
    574
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Yep, I've tried that with 2,3,5 seconds but it always sends no referrer :(
     
    Kendothpro, Apr 24, 2006 IP
  4. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #4
    How about something like having a link, then on body load click that link automatically?

    The only problem with doing things like this is that once someone has JavaScript disabled, for example, you're going to have a non-working page...
     
    TwistMyArm, Apr 24, 2006 IP
  5. Kendothpro

    Kendothpro Well-Known Member

    Messages:
    574
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    120
    #5
    yep...
    anyway is that even possible? would you search for the link in the href array and then url('blablabl') based on that link?
     
    Kendothpro, Apr 25, 2006 IP
  6. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Well, there's no need for an href array, as there's really only one link on the page, isn't there?

    In your HTML, give your href an ID, then call document.getElementById( the_id ).click() on body load.

    I believe that that's basically doable :)
     
    TwistMyArm, Apr 25, 2006 IP