redirect different referrers

Discussion in 'PHP' started by matty281k, Feb 5, 2008.

  1. #1
    I used to know how to do this but cant find the script.

    i need a php script that redirects someone if they come threw my site via a certain referer. If they dont come threw that certain referer they can view the site as normal

    anybody know how to do this?
     
    matty281k, Feb 5, 2008 IP
  2. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I believe it was miliscript that you used to use as this was a popular one.

    However I would use a .htaccess to bounce your own custom php to bounce them accordingly.

    Or you can simply use .htaccess to do the whole thing not sure how much data logging is required here.
     
    LittleJonSupportSite, Feb 5, 2008 IP
  3. ToddMicheau

    ToddMicheau Active Member

    Messages:
    183
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    58
    #3
    A simple php function like this would also work. . .

    
    <?
    if(!empty($_SERVER['HTTP_REFERER']) && 
    $_SERVER['HTTP_REFERER'] == "www.spamforums.com"){
         header('Location: http://www.redirected.com/');
    }
    ?>
    <html>
    <body>
    Regular site
    </body>
    </html>
    
    Code (markup):
    http://us3.php.net/header

    http://us3.php.net/reserved.variables
     
    ToddMicheau, Feb 5, 2008 IP