orbitnet.ru

Redirect Generator

Build redirect rules for nginx or Apache from a simple list. Use old -> new per line, with an optional status code.

Rules

old -> new [code]. A trailing * creates a wildcard rule; $1 receives the remaining path.

Config snippet

Examples

/old -> /new /docs/* -> https://docs.example.com/$1 http://example.com/legacy -> https://example.com/new 308

nginx exact rules use location = and return; wildcard rules use rewrite so the suffix is not taken from a decoded return capture. Apache uses RedirectMatch for both exact and wildcard paths.

Source and target values reject control characters, single/double quotes, backticks, backslashes, $ (except the wildcard $1 placeholder), braces and semicolons. Regex metacharacters in the source path are escaped automatically. nginx wildcard rules support 301 and 302; use Apache for wildcard 307/308.

nginx ordering: wildcard rewrite rules run at server level before nginx selects a location. If a wildcard source is a prefix of an exact source, the wildcard handles the request regardless of the order in this list. Avoid overlapping rules, put exact-only paths under a non-overlapping prefix, or use Apache for mixed rules.

Always test redirects in a staging environment. Avoid redirect chains, and use 301/308 only when the move is permanent.