重写条件以从智能手机检查移动用户代理 [英] Rewrite condition to check mobile user agent from smart phones
本文介绍了重写条件以从智能手机检查移动用户代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在编写重写条件以检查用户代理.
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
我有这样的东西
RewriteCond %{HTTP_USER_AGENT} Mobile [AND]
RewriteCond %{HTTP_USER_AGENT} !"android|blackberry|IOS|windows phone" [NC]
有人可以纠正这个问题吗?
Can some one correct this.
推荐答案
RewriteCond %{HTTP_USER_AGENT} ^.*(Android|BlackBerry|iPhone|Windows Phone).*$ [NC]
RewriteRule ^(.+)$ /go_to_mobile_or_403/$1 [L]
来源: http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet .html#HTTP_USER_AGENT
这篇关于重写条件以从智能手机检查移动用户代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文