例如访问https://my.website/aaa.html?para=correct
时返回aaa.html
的内容,否则跳转到bbb.html
。
目前我在配置文件中写了query_string
但是感觉会死循环:
# Test location ~* ^/aaa.html { #设置 content type default_type text/html ; # HTTP Status Code 和 内容 if ($query_string ~ ".*(?:^|\?|&)para=correct(?:(?:&.*)|$)") { return 200 /aaa.html; } return 200 /bbb.html; }
1 julyclyde 2022-09-19 14:00:32 +08:00 if ($arg_para=correct) |
2 julyclyde 2022-09-19 14:01:13 +08:00 担心死循环的话,就把逻辑反过来写 只处理错误的情况,return404 ;正常情况就让 nginx 自己管 |