xin

Directive reference

rewrite

Matches and rewrites a URI using a regular expression.

Syntaxrewrite regex replacement [last | break | redirect | permanent];
Contextsserverlocationif
Defaultnone

Behavior

Rules execute in declaration order. last restarts location selection; break keeps processing in the current location.

Example

rewrite ^/old/(.*)$ /new/$1 permanent;

Related directives

return · set · location