Directive reference
rewrite
Matches and rewrites a URI using a regular expression.
| Syntax | rewrite regex replacement [last | break | redirect | permanent]; |
|---|---|
| Contexts | serverlocationif |
| Default | none |
Behavior
Rules execute in declaration order. last restarts location selection; break keeps processing in the current location.
Example
rewrite ^/old/(.*)$ /new/$1 permanent;