User Agent Redirection Script

Status
Not open for further replies.

Romestar

Member
Aug 20, 2006
680
5
18
I've been looking for a (free) script that will redirect users based off of their user agent. I've been having some trouble finding one, if you could help me out I would appreciate it. Thanks.
 


<?php
$useragent = $_SERVER['HTTP_USER_AGENT'];
function agent($browser) {
return stristr($useragent,$browser);
}
if(agent("google"))
{
header("Location:http://cloakedsite.com");
}
else
{
header("Location:http://realsite.com");
}
?>
That should get you started.
 
That's exactly what I needed, thanks :)

Not to cock-block dude, but remember that google WILL run a couple of those scripts WITHOUT the google user agent, JUST to check for cloacked pages. BUT it WILL last a while (until their OTHER agent hits you)

Maybe check the IPs too, they have like 100,000 servers right? or is that just their web server :xomunch:
 
Status
Not open for further replies.