modifying http_referer in php

Discussion in 'PHP' started by mi6hq, Jan 27, 2018.

  1. #1
    I want to modify http_referer before redirecting visitor to another site.

    <?
    header("Referer: http://www.msn.com");
    header("Location: http://www.tracemyip.org");
    ?>
    PHP:
    This is not working, help please.
     
    mi6hq, Jan 27, 2018 IP
  2. voon

    voon Active Member

    Messages:
    23
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    63
    #2
    Referer is a HTTP request header by user agent (browser). Where as Location is HTTP response header by server. I think both will not work together, at least not from server side.

    
    User Agent <-- response -- Server (http://www.yourwebsite.com)
      Referer: http://www.msn.com //ignored?
      Location: http://www.tracemyip.org //follow this URL
    
    User Agent -- request --> Server (http://www.tracemyip.org)
      Referer: http://www.yourwebsite.com //I'm from this URL
    
    Code (markup):
    There are some attempts to modify Referer header on client side with Javascript. Not sure it will work though.

    Or may be <a href="http://www.tracemyip.org" rel="noreferrer"> would help?
     
    Last edited: Jan 28, 2018
    voon, Jan 28, 2018 IP
  3. phpmillion

    phpmillion Member

    Messages:
    145
    Likes Received:
    11
    Best Answers:
    4
    Trophy Points:
    45
    #3
    What do you want to do exactly? If you provide a detailed description of your issue, you will surely get some help.
     
    phpmillion, Jan 29, 2018 IP
    Fiverscripts likes this.
  4. jestep

    jestep Prominent Member

    Messages:
    3,659
    Likes Received:
    215
    Best Answers:
    19
    Trophy Points:
    330
    #4
    You can't do this for a bunch of good reasons.
     
    jestep, Jan 29, 2018 IP