
1 alanying OP 顶起求看到 |
2 rzti483NAJ66l669 2019 年 8 月 5 日 Rewrite |
3 registerrr 2019 年 8 月 5 日 via Android 直接 onload (){window.open(window.location.href + “?aff=001 “)} |
4 luofeii 2019 年 8 月 5 日 后端 setHeader("Location",跳转地址拼接参数),状态码 307 |
6 alanying OP @registerrr 在 nginx 那边加这个么? |
7 limuyan44 2019 年 8 月 6 日 server { listen 80; server_name abc.com; access_log logs/host.access.log main; if ( $request_uri = "/help1.html" ){ rewrite ^/(.*)$ http://ww.edf.com/$1?aff=001 permanent; } |
9 ysc3839 2019 年 8 月 6 日 via Android @limuyan44 Nginx 官方文章 Pitfalls and Common Mistakes 恰好就写了这种错误 https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#taxing-rewrites 可以改成 location block + return 301 的形式。 |
11 limuyan44 2019 年 8 月 6 日 @ysc3839 看了下文章,return 确实要好, @alanying lz 用这个吧 if ( $request_uri = "/help1.html" ){ return 301 http://www.edf.com/help1.html?aff=001; } |
12 registerrr 2019 年 8 月 6 日 via Android @alanying 我这个是纯前端的,能在后端实现更好 |
13 opengps 2019 年 8 月 6 日 via Android 前端后端控制都行,建议用后端的 redirect |
15 limuyan44 2019 年 8 月 6 日 via Android 不是很明白你说的其他页面什么意思,按你的要求地址都是写死的,你把 help.html 换成其他页面就好了啊。 |
17 limuyan44 2019 年 8 月 6 日 @alanying 支持的,但是还是没明白你要干什么。可能你要的是下面这种?转发请求到新地址并且添加参数?你把 location 后面的表达式换掉,www.zycat.top 换成你自己的就可以了。 location ~* \.(gif|jpg|jpeg)$ { return 301 http://www.zycat.top$uri?aff=001; } |
18 alanying OP |
19 limuyan44 2019 年 8 月 6 日 |
20 alanying OP @limuyan44 我自己写了个 ```bash if ($host = 'abc.com') { rewrite ^/(.*)$ http://def.com/$1?aff=001 permanent; } ``` |