Redirect Generator

301 and 302 rules for Apache, Nginx, Vercel, Netlify or a meta refresh.

About Redirect Generator

A redirect generator that turns a list of from and to paths into 301 or 302 rules for Apache .htaccess, Nginx, Vercel, Netlify or an HTML meta refresh.

How to use

  1. Add a row for each redirect: the old path, the new path or full URL, and a status of 301, 302, 307 or 308.
  2. Or switch to "Paste lines" and paste one rule per line, as /old /new 301. The status is optional, and -> goes between paths that contain spaces.
  3. Pick the output format, then copy or download the result. A note under the output says where it belongs.

What it does

  • Apache: a RedirectMatch line per rule with an anchored, escaped pattern, so /file.html matches only that exact path.
  • Nginx: an exact-match location = /old { return 301 /new; } line per rule, quoted where the path needs it.
  • Vercel: a redirects array for vercel.json, using permanent for 308 and 307 and statusCode for 301 and 302.
  • Netlify: _redirects lines. Netlify documents 301 and 302 only, so 307 is written as 302 and 308 as 301, with a comment saying so.
  • HTML: a small page per rule with a zero-second meta refresh and a canonical link, for hosts with no redirect support. It sends no status code.
  • Escapes for each target: regex characters for Apache, $ and quoting for Nginx, path pattern characters for Vercel, and percent-encoding of spaces for Netlify and for every destination.
  • Reports rules it cannot write: a source that is not a path, a source with a query string, an unknown status, a rule that points at itself, and a repeated source.
  • Does not write wildcard or pattern redirects, does not match on query strings or domains, and does not detect chains or loops across rules. The output is not tested against a server, so try one rule after deploying.

Example

/old-page  /new-page  301

Apache   RedirectMatch 301 "^/old-page
quot; "/new-page" Nginx location = /old-page { return 301 /new-page; } Netlify /old-page /new-page 301

Privacy

The rules are converted in the browser. No request is made, the URLs are not visited, and nothing is stored.

Frequently asked questions

How do I redirect a URL in .htaccess?
Add a line such as RedirectMatch 301 "^/old-page
quot; "/new-page" to the .htaccess file in the site root. It needs mod_alias, which is normally enabled, and the pattern is a regular expression, so dots and other special characters in the path must be escaped.
What is the difference between a 301 and a 302 redirect?
301 says the move is permanent, so browsers cache it and search engines replace the old URL with the new one. 302 says it is temporary, so the old URL is kept. 308 and 307 are the same pair, except that the request method is never changed from POST to GET.
How do I redirect a page in Nginx?
Inside the server block, add location = /old-page { return 301 /new-page; } and reload Nginx. The equals sign makes it an exact match, so other paths are not affected.
Is a meta refresh as good as a 301 redirect?
No. A meta refresh happens in the browser after the page has loaded and sends no redirect status code. Search engines generally treat an instant refresh as a redirect, but a server-side 301 is the clearer signal. Use the HTML version only where the host cannot send redirects.