More and more internet traffic is generated by the iPhone and iPod touch.
The PHP snippet below shows you how to automatically redirect your users to a page which is optimized for the iPhone Safari browser.
if(strstr($_SERVER['HTTP_USER_AGENT'],'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPod')) { // Change your URL below header('Location: http://www.domain.com/iphone'); exit(); }
good idea
i think it would be better if we use strtolower to match the userAgent
thanks 4 ur great articles, U ROCK!
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
if(preg_match(‘/iphone/’, $userAgent) || preg_match(‘/ipod/’, $userAgent)) {
//do whatever u want
}