I'm using Apache's rewrite url. .htaccess file contains following redirect rules. My requirement is that, when ever I hit on the url www.temp.com/card
, based on the device it should internally call that particular .do
.
For Example, from a smart phone if i type www.temp.com/card
internally it should call www.temp.com/pa/spCard.do
.
I tried with the below rules but problem is that some tablets having android, so in tablet it always going into smarphone .do
.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteRule ^card/?$ /pa/spCard.do?uri=$1 [QSA]
RewriteCond %{HTTP_USER_AGENT} "ipad" [NC]
RewriteRule ^card/?$ /pa/tabCard.do?uri=$1 [QSA]
RewriteRule ^card/?$ /pa/webCard.do?uri=$1 [QSA]
</IfModule>
Is there any way we can distinguish between an Android mobile and tablet (using user agent string)?