Module ngx_http_rewrite_module

The ngx_http_rewrite_module module is used to change request URI using PCRE regular expressions, return redirects, and conditionally select configurations.

The ngx_http_rewrite_module module directives are processed in the following order:

  • the directives of this module specified on the server level are executed sequentially;
  • repeatedly:
    • a location is searched based on a request URI;
    • the directives of this module specified inside the found location are executed sequentially;
    • the loop is repeated if a request URI was rewritten, but not more than 10 times.
break
  • References/Server/Nginx/Modules reference/ngx_http_rewrite_module

Syntax: break; Default: — Context: server, location

2025-01-10 15:47:30
rewrite
  • References/Server/Nginx/Modules reference/ngx_http_rewrite_module

Syntax: rewrite regex replacement [flag];

2025-01-10 15:47:30
return
  • References/Server/Nginx/Modules reference/ngx_http_rewrite_module

Syntax: return code [text];return code

2025-01-10 15:47:30
set
  • References/Server/Nginx/Modules reference/ngx_http_rewrite_module

Syntax: set $variable value; Default: —

2025-01-10 15:47:30
uninitialized_variable_warn
  • References/Server/Nginx/Modules reference/ngx_http_rewrite_module

Syntax: uninitialized_variable_warn on | off; Default: uni

2025-01-10 15:47:30
if
  • References/Server/Nginx/Modules reference/ngx_http_rewrite_module

Syntax: if (condition) { ... } Default: — Context:

2025-01-10 15:47:30
rewrite_log
  • References/Server/Nginx/Modules reference/ngx_http_rewrite_module

Syntax: rewrite_log on | off; Default: rewrite_log off;

2025-01-10 15:47:30