Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app下载链接适配 #11

Open
hanyitim opened this issue Nov 9, 2020 · 0 comments
Open

app下载链接适配 #11

hanyitim opened this issue Nov 9, 2020 · 0 comments

Comments

@hanyitim
Copy link
Owner

hanyitim commented Nov 9, 2020

app下载链接适配

背景

  • app的推广页需要有一个下载链接,方便用户点击的时候直接下载app,但是不同的系统下载的地方不一样;

方案

通过userAgent判断具体是哪个系统,是否在微信内打开,然后通过调整respones解决;

  1. 通过node服务
  2. 通过Nginx

以上两种方式都可以解决这个问题,基于一些环境原因,选择用Nginx的方式去解决

Nginx

server {
    listen    80;
    server_name  www.a.com a.com;
    charset utf-8;


    location /applink {
        #微信浏览器
        if ($http_user_agent ~* "micromessenger" ){
                rewrite ^/.*    https://a.com/ulink/action/  redirect;
        }
        if ($http_user_agent ~* "android"){
                rewrite ^/.*    https://a.com/apk/appname.apk redirect;
        }
        
        if ($http_user_agent ~* "iphone"){
                rewrite ^/.*    https://apps.apple.com/cn/app/ redirect;
        }
        rewrite ^/.*    http://lizhifm.cn/d  redirect;
    }
    
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant