骑驴找蚂蚁

全干工程师

根据nginx的useragent跳转IE浏览器为http

map $http_user_agent $is_xp {
            default 0;
            "~Windows NT 5.1" 1;
            "~Windows NT 5.2" 1;
        }

        map $http_user_agent $is_ie {
            default 0;
            "~MSIE 6" 1;
            "~MSIE 7" 1;
            "~MSIE 8" 1;
        }

        map $is_xp$is_ie $winie {
            default 0;
            "11" 1;
        }

以上代码需要写在http标签中。

if ($winie = 0) { 
#如果不是ie 加xp就跳转到https
    return 301 https://$host$request_uri;
}
if ($winie = 1) {
#如果是ie加xp就跳转到http
    return 301 http://$host$request_uri;
}

留言