I created a mobile version of a client's website. I created a subdomain called mobile.sitename.com
In the past I have used this code on the index.php page:
<?php $mobile = "http://mobile.cogistix.com";
if(preg_match('/Windows CE/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match("/iphone/i",$_SERVER["HTTP_USER_AGENT"])) { header("location: $mobile");}
elseif(preg_match('/Blackberry/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/PalmOS/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/PalmSource/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/SymbianOS/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/Opera Mini/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/Nokia/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/Samsung/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/vodaphone/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/Jphone/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/AvantGo/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/DoCoMo/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
elseif(preg_match('/DDIPOCKET/i',$_SERVER['HTTP_USER_AGENT'])) { header("location: $mobile");}
?>
It usually works great. But this time when I try to bring it up on my iPhone I get a "Cannot open Page because too many redirects" error. Does anyone know why this would be?
Thanks!