Reputation: 17893
I am writing rewrite condition to check user agent.
1. The request should be from Mobile and
2. The request should not be from iphone/Black Berry/Android Device/ Windows Phone
I got some thing like this
RewriteCond %{HTTP_USER_AGENT} Mobile [AND]
RewriteCond %{HTTP_USER_AGENT} !"android|blackberry|IOS|windows phone" [NC]
Can some one correct this.
Upvotes: 3
Views: 4963
Reputation: 1271
RewriteCond %{HTTP_USER_AGENT} ^.*(Android|BlackBerry|iPhone|Windows Phone).*$ [NC]
RewriteRule ^(.+)$ /go_to_mobile_or_403/$1 [L]
source: http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html#HTTP_USER_AGENT
Upvotes: 6