rewrite ^/(.*).html$ /.html?mode=test redirect;
Now there is a rewrite rule like the above, which can take effect, but it will redirect
multiple times. How to modify it so that it only jumps once?
Using break
will not work, because break
will not modify the browser address bar.
For example: http://xxx.xx.xx/weather/bug.html
will keep jumping and weather/bug.html?mode=test&mode=test&mode= will appear test&mode=test&mode=test&mode=test&mode=test&mode=test&mode……
location / {
if($args *~ "mode=formal"){
rewrite (.*) ? redirect;
rewrite (.*) ?mode=test redirect;
}
else if($args [[不包含mode=test]]){
rewrite ^/(.*).html$ /.html?mode=test redirect;
}
error_page 404 = @nodejs;
}
I want to configure it in the above way, first judge $args
, and then rewrite, I don’t know if it is possible.
And how should I write [[excluding mode=test]]?