After the last: rewrite match, a request is initiated again, and only the rules in location are matched again.
After the break: rewrite matches, no request is initiated or the following rules are matched.
Example:
Location /{
Root html;
Index. php index.html index.htm;
}
If ($ request_uri ~ */Cms /){
Rewrite "^/cms/(. *) \. php"/cms/index. php break;
# You can also use last here. if it is processed only once
# "If" and "(" space required
}
Location /{
Root html;
Index. php index.html index.htm;
If ($ request_uri ~ */Cms /){
Rewrite "^/cms/(. *) \. php"/cms/index. php break;
# Here, using last will cause an endless loop, and if in location will process multiple times
}
}
Note that the url has question marks.
Do not add "? "And add "? "Marked URL jump differences
Rewrite ^/test (. *) $ http://www.yourdomain.com/home permanent;
Access http://www.yourdomain.com/test? Id = 5 the URL after the 301 jump is
Http://www.yourdomain.com/home? Id = 5
Rewrite ^/test (. *) $ http://yourdomain.com/home? Permanent;
Access http://www.yourdomain.com/test? Id = 5 the URL after the 301 jump is
Http://www.yourdomain.com/home
This article from the "fly World" blog, please be sure to keep this source http://liuping0906.blog.51cto.com/2516248/1301125