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
Result
Example
/old-page /new-page /blog/2019/launch /blog/launch 301 /promo https://shop.example.com/fall 302 /docs/v1 /docs/v2 308
# _redirects: from, to, status. Rules are checked top to bottom and the first match 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
- Enter one redirect per line in the input box: the old path, a space, the new URL and an optional status code.
- Choose an Output format and a Default status code.
- Press Run.
- 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.
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.