nginx判断设备跳下载地址

server {
listen 10037;
server_name 1.11.1.0;

access_log /home/app/logs/nginx/10037_access.log;
error_log /home/app/logs/nginx/10037_error.log;
charset utf-8;

location = / {
# 华为
if ( $http_user_agent ~* “huawei|honor” ) {
rewrite ^/$ market://details?id=xxx redirect;
}
# vivo
if ( $http_user_agent ~ ” vivo| V19| V18| V17″) {
rewrite ^/$ market://details?id=xxx redirect;
}
# 小米
if ( $http_user_agent ~ “Mi |Redmi |MI |REDMI |Build/HM|M1 | MIX “) {
rewrite ^/$ http://app.mi.com/detail/xxxx redirect;
}
# oppo
if ( $http_user_agent ~ ” OPPO|; N5|; M57|; R6|; R7|; X9|; A31|; R8|ONEPLUS”) {
rewrite ^/$ market://details?id=xxxx  redirect;
}

# QQ and wechat
if ( $http_user_agent ~ “QQ/|MicroMessenger/”) {
rewrite ^/$ https://a.app.qq.com/o/simple.jsp?pkgname=xxx redirect;
}
if ( $http_user_agent ~* “iphone|ipad|ipod” ) {
rewrite ^/$ https://itunes.apple.com/cn/app/xxx redirect;
}

# other
rewrite ^/$ https://a.app.qq.com/o/simple.jsp?pkgname=xxxx redirect;
}

location / {
try_files $uri $uri/ =404;
}
}


发表评论

电子邮件地址不会被公开。 必填项已用*标注