Hi, Wondering how I can do this. I'm good at marketing, but appaling at code so take it easy on me ha. I want to redirect a user based on their IP. So, if IP is X, they go to Site A, if anything else, go to Site B. Any ideas?
$ip = getenv("REMOTE_ADDR"); switch ($ip) { case "81.81.91.81": header("Location:hahaha.php"); break; case "81.91.81.81": header("Location:lol.php"); break; } PHP: Hope I helped
Appreciate the reply, thanks! I added that, here is my code. It doesn't seem to be working: <? $ip = getenv("REMOTE_ADDR"); switch ($ip) { case "66.112.215.70": header("Location:http://google.com"); break; } Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://yahoo.com" ); ?> PHP: What the above is meant to do is redirect people who visit my URL "test.com/redirect.php" to Yahoo.com, with the exception of that IP which should be taken to google.com
switch ($_SERVER['REMOTE_ADDR']) { case "127.0.0.1": header("Location: http://www.google.co.uk"); break; default: header("Location: http://www.yahoo.com"); break; } PHP: