http_referer

Hi guy, i nd some help in http_referer.

what i need is if user search my website from A search engine, i will redirect to page-extreame. else if from other search engine, will direct to my homepage. how should i do it? i hv no idea on it. i just know that is using http_referer.

how should i began ?

help is needed and thank you

what kind of search engine you thinking of? google yahoo bing or ?

[php]<?php
if (isset($_SERVER[‘HTTP_REFERER’])) {
$userslocation = $_SERVER[‘HTTP_REFERER’];
}
if ($userslocation = ‘www.google.ca’) {
header( ‘Location: http://www.yoursite.com’ ) ;
}
else {
header(‘Location: http://www.yoursite2.com’) ;
}

?>[/php]

try this instead

[php]

<?php if (isset($_SERVER['HTTP_REFERER'])) { $userslocation = $_SERVER['HTTP_REFERER']; } $pos = strripos($userslocation, "google.com"); if ($pos !== false) { header('Location: http://www.yoursite.com'); }else { header('Location: http://www.yoursite2.com') ; } ?>

[/php]

NOTE: $_SERVER[‘HTTP_REFERER’] only work if the user click to go your site, if the user type the URL manually the $_SERVER[‘HTTP_REFERER’] will be underfined

tq.

it works perfectly.

thanks

i’m glad that i could help you, click the karma [+] below my name.

Sponsor our Newsletter | Privacy Policy | Terms of Service