Redirect Generator (.htaccess, Nginx & More)

Paste an old-URL to new-URL map and get ready-to-deploy redirect rules for six platforms, with automatic detection of chains, loops and duplicate sources.

Server racks in a data centre

Photo by Taylor Vick on Unsplash

Redirect rule generator

Separate the pair with a comma, a tab or one or more spaces.

0Rules
0Chains detected
0Loops detected
0Duplicate sources
Updated: 2 August 2026Read: 8 minMethod: RFC 9110 3xx semanticsRuns: 100% in your browser

Key takeaways

  • Use 301 for permanent moves: it transfers signals and tells crawlers to drop the old URL, which a 302 does not.
  • Chains cost a full round trip per hop and count against Largest Contentful Paint — always redirect in one step.
  • Mass-redirecting old URLs to the homepage is treated as a soft 404 and loses the ranking signals entirely.

Choosing the right status code

CodeMeaningMethod preserved?Use for
301Moved PermanentlyNo — POST may become GETPermanent URL changes, site migrations, HTTP→HTTPS
302FoundNo — POST may become GETTemporary moves, A/B tests, maintenance
307Temporary RedirectYesTemporary moves where the method must be kept
308Permanent RedirectYesPermanent moves for APIs and form endpoints

For SEO the choice is straightforward: use 301 for anything permanent. Google has stated repeatedly that 301s pass essentially all ranking signals, and since 2016 it has said the same of 302s — but a 301 also tells the crawler to update its index and drop the old URL, which a 302 does not. Leaving a permanent move on a 302 keeps the old URL indexed indefinitely.

Full definitions are in the HTTP status code reference.

Chains, loops and why they cost you

A chain is A→B→C. Every hop adds a full round trip: DNS lookup, TCP handshake, TLS negotiation, request, response. On mobile networks that is commonly 300–600 ms per hop, and it is charged directly against Largest Contentful Paint.

A loop is A→B→A. Browsers give up after about twenty hops and show ERR_TOO_MANY_REDIRECTS; crawlers give up sooner and drop the URL.

Google follows up to about ten redirect hops but treats long chains as a crawl inefficiency and may stop consolidating signals along them. The fix is always the same: rewrite the first rule to point at the final destination. This generator flags chains, loops and duplicate sources as you type.

Chains accumulate silently over years. Every redesign adds a layer: /2018-product/2021-product/product. Audit the whole map after each migration and flatten it.

Redirect strategy for a site migration

  1. Crawl the old site first. Export every indexed URL, plus the ones with inbound links and organic traffic. Do this before anything changes.
  2. Map one-to-one where possible. Each old URL should point to its closest equivalent, not to the homepage. Bulk redirects to the root are treated as soft 404s and lose the signals entirely.
  3. Keep the URL structure if you can. The cheapest migration is the one with no redirects.
  4. Redirect in one hop. Old→new directly, even when the intermediate URL exists.
  5. Keep them for at least a year. Google needs repeated crawls to transfer signals fully, and inbound links persist far longer than that. On a large site, keep them permanently.
  6. Update internal links too. Redirects are for external traffic; your own navigation should point straight at the live URL.
  7. Verify after launch. Sample the map, check status codes, and watch the Search Console coverage report for a spike in 404s.

Server syntax notes

Apache

RewriteRule patterns are regular expressions applied to the path without the leading slash. QSA appends the original query string, QSD discards it, and L stops rule processing. For simple one-to-one mappings Redirect 301 /old /new from mod_alias is lighter, but it does not accept patterns.

Nginx

location = /path is an exact match and is evaluated before prefix matches, which makes it both fast and predictable. Use $is_args$args to carry the query string through. Nginx has no per-directory config, so rules live in the server block and need a reload.

Netlify, Cloudflare Pages and Vercel

Netlify and Cloudflare Pages both read a plain _redirects file where the first matching rule wins. Vercel uses a redirects array in vercel.json, with permanent: true emitting a 308 rather than a 301.

Frequently Asked Questions

What is the difference between a 301 and a 302 redirect?

301 means permanent: search engines update their index to the new URL. 302 means temporary: the original URL stays indexed. Use 301 for anything that will not move back.

Do 301 redirects lose PageRank?

No. Google confirmed in 2016 that no PageRank is lost through 3xx redirects. What you do lose is time and crawl efficiency when redirects are chained.

How long should I keep redirects in place?

At least a year, and preferably permanently. Signals transfer over repeated crawls and external links to old URLs can persist for a decade.

What is a redirect chain?

Two or more hops between the requested URL and the final one, such as A→B→C. Each hop adds latency and dilutes crawl efficiency; always point the first rule at the final destination.

Should I redirect everything to the homepage?

No. Google treats mass redirects to the homepage as soft 404s and the ranking signals are lost. Map each URL to its closest equivalent, or return a genuine 404 or 410 if there is none.

What is the difference between 307 and 302?

307 guarantees the HTTP method and body are preserved. 302 historically allowed clients to convert POST to GET. Use 307 or 308 for API and form endpoints.

Do redirects slow down my site?

Yes, measurably. Each hop is a full round trip — often 300 ms or more on mobile — and it counts against Largest Contentful Paint.

Sources & further reading

  1. Google Search Central: Redirects and Google Search — how each redirect type is interpreted for indexing
  2. RFC 9110 §15.4 — the normative definitions of all 3xx status codes
  3. Apache mod_rewrite — RewriteRule syntax and flag reference
  4. Nginx rewrite module — return and rewrite directive documentation