PHP Redirects & modifying browser info... Impossible?? Please Help!

Discussion in 'PHP' started by itsme, Jan 27, 2006.

  1. #1
    I often use scripts or .htaccess for redirects of affiliate links or other outbound links, it looks like the pages are on my site and it works ok...

    I have a problem when I try to accomplish the following:

    Redirect using the PHP header(Location: xxxx) AND set the browser REFERAL value.

    The redirect is easy, but I NEED to set the referal value so I can track WHICH script (not link) performed the redirect. When doing a PHP header() redirect, the browser's referal value will be the page that contained the LINK that was clicked... I need to know which redirection script was used (since I use different ones, it's part of an experiment...).

    I need to set the browser's referal value AND redirect to the new location. Is this possible using PHP?

    If I use JavaScript, a simple JS redirect will leave the proper referal info, but I don't want to use JS since some people dissable it and that means lost sales.

    PLEASE HELP!
     
    itsme, Jan 27, 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
    Not possible. The end user's referring URL is read only. You would need to track it with something unique in the URL or maybe with a cookie.
     
    digitalpoint, Jan 27, 2006 IP
  3. itsme

    itsme Well-Known Member

    Messages:
    1,232
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    180
    #3
    That's what I was afraid of.

    Thanks. and I think that was the fastest reply in history! ;)
     
    itsme, Jan 27, 2006 IP
  4. tccoder

    tccoder Peon

    Messages:
    69
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    using a cookie like Referer

    that you can change would be a easy and simple way to do it
     
    tccoder, Jan 28, 2006 IP
  5. itsme

    itsme Well-Known Member

    Messages:
    1,232
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    180
    #5
    Yes a cookie is easy enough but the reason I was hoping to do it via PHP is so it can be 100% fail safe.

    JS and cookies can be very easily blocked, and usually are by many people who use pop-up and ad blockers.

    It's no big deal, I'll probably just do it by implementing a JavaScript redirect (for the instant redirect) and just in case they have JS blocking I'll also do a meta refresh for 3 sec. That way the JS (if allowed) will redirect them and write the refferer info, and if the JS doesn't get run the meta refresh will redirect them without the referal info.

    It's a compromise but I hope it will solve my problem.

    If I notice a drop in sales/conversions I will just resort to a normal PHP or .htaccess redirect and who cares about my little tracking experiment... it's the $$ that count. :)
     
    itsme, Jan 30, 2006 IP
  6. Important

    Important Peon

    Messages:
    87
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Important, Jan 30, 2006 IP
  7. itsme

    itsme Well-Known Member

    Messages:
    1,232
    Likes Received:
    96
    Best Answers:
    0
    Trophy Points:
    180
    #7
    because I use redirects to "clean up" the urls and make it look nice. There are a lot of people who don't click on URLs with ref details!

    the URLs I use: mydomain.com/go/newpage

    is nicer to look at than the long URLs needed to accomplish the proper tracking... it's not a big deal. I will try several different solutions and see what works best.

    Thanks all for the tips.
     
    itsme, Jan 30, 2006 IP