Ipad detection with PHP and htaccess

This wil return a 1 value if it’s an iPad:

$ipad_or_not = (bool) strpos($_SERVER[‘HTTP_USER_AGENT’],‘iPad’);

 

You also can redirect with htaccess:

RewriteEngine On

RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$

RewriteRule ^(.*)$ http://ipad.yourdomain.com [R=301]

Leave a comment