Nginx rewrite four kinds of flag

Use nginx's rewrite command, URL rewriting can be achieved, can server nginx configuration files, location, if partially used for the rewrite four different flag.

redirect: return to 302 temporary redirect the browser address bar displays the URL address after the jump, reptile does not update URL
Permanent: return 301 permanent redirect, the browser address bar displays the URL address after the jump, reptiles updated the URL of
BREAK: stop processing of subsequent rewrite instruction set, will not jump out of the scope of location, not re-find, termination matching, URL address unchanged
after cessation of treatment follow-up rewrite instruction set, location out of scope, and began to search for and change: last location of URI that matches, URL addresses unchanged

And permanent redirect which is well understood, the direct URL address of the redirect URL address is displayed after the jump, from an implementation point of view function, and permanent redirect is the same, the quality and performance problems do not exist, the main part All effects on seo.

Illustration and break last, following is an example of the configuration:

Visit http: // DEMO / abc / *, the return to 404, if there is a corresponding file in the directory 200 returns whsir

Visit http: // when DEMO / opq / *, to match the / whsir /, then jump out location scopes, to match the location / whsir /, then return 403

as last break and will stop processing a subsequent rewrite module operating instructions, but will re-initiate a last request, and re-match location

Guess you like

Origin www.cnblogs.com/xzlive/p/11454383.html