手机访问自动跳转

$ua = strtolower($_SERVER[‘HTTP_USER_AGENT‘]);
$uachar = "/(nokia|sony|ericsson|mot|samsung|sgh|lg|philips|panasonic|alcatel|lenovo|cldc|midp|mobile)/i";
$smartuachar = "/(ipad)/i";

if(!(preg_match($smartuachar, $ua)) && ($ua == ‘‘ || preg_match($uachar, $ua))&& !strpos(strtolower($_SERVER[‘REQUEST_URI‘]),‘wap‘))
{
    $Loaction = ‘mobile/‘;

    if (!empty($Loaction))
    {
        ecs_header("Location: $Loaction\n");

        exit;
    }

}
时间: 2024-12-11 11:59:59

手机访问自动跳转的相关文章

js识别手机访问自动跳转到相应页面

/* * 智能机浏览器版本信息: * */ var browser={ versions:function(){ var u = navigator.userAgent, app = navigator.appVersion; return {//移动终端浏览器版本信息 trident: u.indexOf("Trident") > -1, //IE内核 presto: u.indexOf("Presto") > -1, //opera内核 webKit

nginx配置http访问自动跳转到https

一.按照如下格式修改nginx.conf 配置文件,80端口会自动转给443端口,这样就强制使用SSL证书加密了.访问http的时候会自动跳转到https上面. server { listen 80; server_name www.域名.com; rewrite ^(.*) https://$server_name$1 permanent; } server { listen 443; server_name www.域名.com; root /home/www; ssl on; ssl_ce

单台web服务器实现http访问自动跳转到https:

方法一:利用地址重写功能server {listen 80;server_name www.etiantian.org;rewrite ^(.*)$ https://$host$1 permanent;}说明:在https配置server基础上再添加http跳转server 方法二:利用error_page识别错误码信息进行跳转server {listen 443;server_name www.etiantian.org;ssl on;ssl_certificate /application/

js判断是手机访问网站跳转

<script src="http://siteapp.baidu.com/static/webappservice/uaredirect.js" type="text/javascript"></script> <script type="text/javascript">uaredirect("你的手机版网址");</script>

判断网站是否手机访问并跳转到指定的wap网站

第一种:直接JS脚本<script type="text/javascript">try { var urlhash = window.location.hash; if (!urlhash.match("fromapp")){ if (navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i)){ window.location="http://192.168.0.108/smar

判断网站是手机访问,跳到手机版!

判断函数: function uaredirect(f){try{if(document.getElementById("bdmark")!=null){return}var b=false;if(arguments[1]){var e=window.location.host;var a=window.location.href;if(isSubdomain(arguments[1],e)==1){f=f+"/#m/"+a;b=true}else{if(isSub

手机访问网跳转到手机端

<script type="text/javascript" language="javascript"> var url = location.href; if (url.indexOf("pc") < 0) { var is_iPd = navigator.userAgent.match(/(iPad|iPod|iPhone)/i) != null; var is_mobi = navigator.userAgent.toL

如果是手机访问则跳转页面

<script type="text/javascript"> function uaredirect(f) { try { if (document.getElementById("bdmark") != null) { return } var b = false; if (arguments[1]) { var e = window.location.host; var a = window.location.href; if (isSubdoma

判断移动设备访问自动跳转到移动版页面

UA判断,写js里面,页面加载时执行 if( /Android|webOS| iPhone | iPad | iPod |BlackBerry|opera mini|opera mobile|appleWebkit.*mobile|mobile/i.test(navigator.userAgent) ) { window.location = 'wap.html'; }