帝国cms服务器判断终端跳转代码

nginx服务器判断终端跳转代码,一句话就完成了。if ($http_user_agent ~* (iphone|ipod|android|blackberry)) { rewrite ^ $scheme://www.11px.cn$request_uri?; }当然,apache服务器判断终端跳转代码

[时间:11-05]    [浏览:]    [放入收藏夹]    [查看详情]

nginx服务器判断终端跳转代码,一句话就完成了。

if ($http_user_agent ~* (iphone|ipod|android|blackberry)) { rewrite ^ $scheme://www.11px.cn$request_uri?; }

当然,apache服务器判断终端跳转代码 也是一句话就搞定了。

RewriteCond %{HTTP_USER_AGENT} “iphone|ipod|android|blackberry” [NC]  RewriteRule ^(.*)$  https://www.11px.cn/$1[L,R=302]

以上方法不错,也许并未全部支持。更喜欢在程序上判断朋友可以用下面的代码。

function isMobile() { $mobile = array(); static $mobilebrowser_list ='Mobile|iPhone|Android|WAP|NetFront|JAVA|OperasMini|UCWEB|WindowssCE|Symbian|Series|webOS|SonyEricsson|Sony|BlackBerry|Cellphone|dopod|Nokia|samsung|PalmSource|Xphone|Xda|Smartphone|PIEPlus|MEIZU|MIDP|CLDC'; //note 获取手机浏览器 if(preg_match("/$mobilebrowser_list/i", $_SERVER['HTTP_USER_AGENT'], $mobile)) { return true; }else{ if(preg_match('/(mozilla|chrome|safari|opera|m3gate|winwap|openwave)/i', $_SERVER['HTTP_USER_AGENT'])) { return false; }else{ if($_GET['mobile'] === 'yes') { return true; }else{ return false; } } } }

其他帝国CMS判断多终端跳转的教程集合:

帝国cms服务器判断终端跳转代码:https://www.11px.cn/jiaocheng/ecms/2017-03-02/250.html

帝国cms判断PC端跳转手机端教程:https://www.11px.cn/jiaocheng/ecms/158.html

帝国cms判断手机用户跳转:https://www.11px.cn/jiaocheng/ecms/2013-09-05/60.html

  本文转载自:精准像素:11px.cn ,感谢作者分享实用知识


标签: