问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/18981991/rewrite-condition-to-check-mobile-user-agent-from-smart-phones