Tuesday, 29 October 2013

Detect And Redirect Android Users With .htaccess

Important: All scripts hosted on widcraft.googlecode.com don't work anymore because Google has blocked that SVN repository.
Last night I shared a trick to redirect Android users to your Android/mobile website with a simple PHP snippet. It's time to do the same with .htaccess file. Android is the most used smart phone platform right now, and is a hot topic for developers.

Add this following code to your .htaccess file to redirect users with Android User Agent to a specific address:

RewriteCond %{HTTP_USER_AGENT} ^.*Android.*$
RewriteRule ^(.*)$ http://android.yourwebsite.com [R=301]
Important: Check our new website TricksPanda.com for WordPress tutorials, plugins and more.
 
Powered by Blogger.