Detect iPad using .htaccess

Here is the small trick with which you can detect the iPad using htaccess file and make the redirection accordingly.

This will be very useful when you are about to create a separate page for iPad users and want then to redirect.

Have a look at below code block which detects the iPad using htaccess file and redirecting to separate page for iPad.

RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$ RewriteRule ^(.*)$ [R=301]
  RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$
  RewriteRule ^(.*)$ [R=301]

You can see that this code uses one of the available server variable which is User Agent and checking for the ipad using regular expression. If that condition satisfies then it will perform the redirection step just below it.

Related Posts

Written by Avinash

Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.

View all posts by: