1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to load or refresh/url if referrer is=

Discussion in 'Programming' started by n00bl3t, Mar 23, 2013.

  1. #1
    hello,

    Does anybody give me an idea how to make this happen?

    I know about this little script:

    <metahttp-equiv="refresh"content="10;url=http://example.com"/>

    but I want to add a little script before this is loaded.

    I only want the url to refresh IF the referrer is from www.123.com..

    so this is the scenario:

    if visitor A goes into www.xyz.com and he/she is coming from search engine the refresh code above will not load...

    if visitor B goes into www.xyz.com and he/she is coming from www.123.com the refresh/reload code above will kick in..

    Any help is very much appreciated...
    n00bl3t, Mar 23, 2013 IP
  2. webdeveloperindia

    webdeveloperindia Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    1
    Trophy Points:
    48
    #2
    Hey Its very simple, check this out.
    You don't need to use HTML meta refresh if you are using php, here is the sample code :


    if (stripos(parse_url($_SERVER['HTTP_REFERER'], PHP_URL_HOST), 'google') !== FALSE) {
    header('Location: http://www.example.com');
    }
    webdeveloperindia, Mar 23, 2013 IP
  3. Code Developer

    Code Developer Active Member

    Messages:
    48
    Likes Received:
    2
    Best Answers:
    2
    Trophy Points:
    58
    #3
    Below code might work (not tested) :

    PHP:
    1. <?php
    2. $ref = $_SERVER['HTTP_REFERER'];
    3. if ($_SERVER['HTTP_REFERER'] == 'www.123.com') {
    4. header('Location: http://www.xyz.com');
    5. }
    6. ?>
    Good Luck!
    Code Developer, Apr 20, 2013 IP