Redirect with referrer change

Discussion in 'Programming' started by eho, Dec 9, 2012.

  1. #1
    Hello,

    I need a script that will change ref and redirect user. PHP if possible or java.

    Example:

    I have few websites like:

    http://exemple1.com
    http://example2.com
    http://example3.com
    etc.

    Surfer click on a link at any of these websites pointing to another of my websites, for example:

    http://WebsiteWithRedirect.com

    Now here is where this script is installed, so when surfer hits http://WebsiteWithRedirect.com script redirect him to for example http://www.somewebsite.com with referrer WebsiteWithRedirect.com not exemple1.com, example2.com etc.

    With regular header PHP redirect script:
    <?php
       header( 'Location: http://www.somewebsite.com' ) ;
    ?>
    PHP:
    it will redirect with exemple1.com, example2.com etc. as referrer so I need something else.
     
    eho, Dec 9, 2012 IP
  2. tyteen4a03

    tyteen4a03 Member

    Messages:
    30
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    45
    #2
    You can use $_SERVER["HTTP_REFERER"] but this is not always accurate.
     
    tyteen4a03, Dec 10, 2012 IP
  3. glagokulan

    glagokulan Greenhorn

    Messages:
    10
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    11
    #3
    Hi,

    Below code may help you.

    <form method="post" action="http://www.somewebsite.com" name="gForm" id="gForm">
    <input name="referer" type="hidden" value="<?php echo $_SERVER['HTTP_REFERER']; ?>" />
    <script type='text/javascript'>document.gForm.submit();</script>
    </form>

    write the above code in "http://WebsiteWithRedirect.com"
     
    glagokulan, Dec 11, 2012 IP
  4. pr0t0n

    pr0t0n Well-Known Member

    Messages:
    243
    Likes Received:
    10
    Best Answers:
    10
    Trophy Points:
    128
    #4
    I think that method will create POST request on destination site, instead of a GET request (if it works, I haven't tested it actually). A webmaster of a destination website will be able to determine that difference from server logs. If that matters in this case though.
     
    pr0t0n, Dec 11, 2012 IP