检测iPhone浏览器在.htaccess / Apache和重定向到iPhone网站 [英] Detect iPhone browser in .htaccess/apache and redirect to iPhone site
本文介绍了检测iPhone浏览器在.htaccess / Apache和重定向到iPhone网站的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
时有可能发现iPhone的浏览器代理在.htaccess和用户重定向到正确的iPhone页面?
解决方案
当然可以 -
#REDIRECT移动浏览器
的RewriteCond%{HTTP_USER_AGENT} ^ * iPhone。* $
重写规则^(。*)$ http://mobile.yourdomain.com [R = 301]
的RewriteCond%{HTTP_USER_AGENT} ^ *黑莓手机。* $
重写规则^(。*)$ http://mobile.yourdomain.com [R = 301]
的RewriteCond%{HTTP_USER_AGENT} ^ *掌* $
重写规则^(。*)$ http://mobile.yourdomain.com [R = 301]
从这里
Is it possible to detect iPhone browser agent in .htaccess and redirect the user to the correct iPhone page?
解决方案
Sure you can -
#redirect mobile browsers
RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*Palm.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
Taken from here
这篇关于检测iPhone浏览器在.htaccess / Apache和重定向到iPhone网站的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文