Skip to content
Free web tool

Redirect rule generator

This redirect rule generator turns a simple list of old paths and new addresses into server redirect rules. Site owners and developers use it when moving pages, renaming URLs or switching platforms.

  • Runs in your browser
  • Free, no account needed
  • Copy or download the result

Your input

117 characters

Result

# _redirects file. Each line is from, to and status; the first matching rule wins.
/old-page          /new-page                      301
/blog/2019/launch  /blog/launch                   301
/promo             https://shop.example.com/fall  302
/docs/v1           /docs/v2                       308

The short answer

A redirect sends visitors and search engines from an old URL to a new one with an HTTP status code. Use 301 or 308 for a permanent move and 302 or 307 for a temporary one; 307 and 308 also keep the request method. Point each old URL straight at its final destination to avoid chains.

Worked exampleThe four sample redirects make a _redirects file where /old-page goes to /new-page with 301 (the default, since no status was given), /promo goes to https://shop.example.com/fall with 302 and /docs/v1 goes to /docs/v2 with 308.

Example

Input
/old-page /new-page
/blog/2019/launch /blog/launch 301
/promo https://shop.example.com/fall 302
/docs/v1 /docs/v2 308
Result
# _redirects file. Each line is from, to and status; the first matching rule wins.
/old-page          /new-page                      301
/blog/2019/launch  /blog/launch                   301
/promo             https://shop.example.com/fall  302
/docs/v1           /docs/v2                       308

How to use the redirect rule generator

  1. Add one Redirects row per move: the old path, the new URL and an optional status code.
  2. Choose an Output format and a Default status code.
  3. The result updates as you type; Run also works.
  4. Use Copy result or Download and add the rules to your server or hosting config.

How it works

Sources must be exact paths starting with /, without ? or #, and destinations must be a path or a full http or https URL.

Apache output uses RedirectMatch with an anchored pattern and nginx output uses location = blocks, so each rule matches only its exact path.

Duplicate sources, including the same path with and without a trailing slash, redirects to the same path and loops such as /a to /b to /a are rejected.

Chains such as /a to /b to /c are allowed but flagged in a comment in the text formats, so you can point the first path straight to the final URL.

Quotes, semicolons, braces, $ and backslashes are rejected because they can break config files.

Everything runs in your browser. Your input is not uploaded or stored. If you use Copy link, what you entered is placed in the link.

Questions and answers

Should I use 301 or 302?

Use 301 or 308 for permanent moves and 302 or 307 for temporary ones. 307 and 308 also keep the request method, such as POST.

Why use RedirectMatch instead of Redirect in Apache?

Redirect matches a path prefix, so Redirect /old would also catch /old/page. RedirectMatch with ^ and $ matches only the exact path.

What is a redirect chain?

It is when one redirect leads to another before reaching the final page. Each hop adds delay, so it is better to redirect straight to the final URL.

Last updated November 1, 2026. Maintained by SnowRock. How our tools work

All 220 SnowRock tools