Detect iPhone Clients

Posted by & filed under iPhone, PHP.

In PHP:

  1. <?php if (strpos($_SERVER[‘HTTP_USER_AGENT’], ‘iPhone’) !== FALSE)
  2. { header(‘Location: http://labs.bluemetalcorp.com/iphone/’); }
  3. ?>

.htaccess:

  1. RewriteEngine on
  2. RewriteCond ${HTTP_USER_AGENT} iPhone
  3. RewriteRule .* http://labs.bluemetalcorp.com/iphone/