SEO Tools

Redirect Code Generator (301/302/307/308)

Generate .htaccess, Nginx, meta-refresh and JavaScript redirects with the right status code for the job.

Tool

About the Redirect Code Generator

The Redirect Code Generator runs entirely in your browser — your URLs and content never leave your machine. Fill in the fields, click generate, copy the result.

Moved a page? A redirect forwards users and search engines to the new location — but only a 301 (or 308) transfers ranking signals to the destination. Choosing 302 "just for now" on a page you are never bringing back quietly throws away its link equity. This tool writes the snippet for Apache, Nginx, HTML and JS.

How to use this tool

  1. Pick the status code: 301 for permanent moves, 302/307 only if the old URL returns soon.
  2. Choose the server format you will paste into.
  3. Enter the old path and the new absolute URL.
  4. Copy the snippet to the right file — for Apache that is .htaccess at the site root.

Which status code?

CodeMeansEquityUse when
301Moved permanentlyTransfersPage is gone for good (default choice)
302 / 307Temporarily elsewhereNot transferredMaintenance, A/B test, geo swap
308Permanent, method keptTransfersAPIs where POST must stay POST

Rules that prevent damage

  • Never chain A → B → C. Point every old URL directly at the final destination; chains leak speed and confuse crawlers.
  • One hop max for a domain migration — including www→non-www and http→https, which should be single rules.
  • Keep redirects server-side; meta refresh and JS are fallbacks, not SEO tools.
  • Delete the rule when the target page 404s — old redirects live forever by default and slow every crawl.

Who is this tool for?

Webmasters restructuring a site, devs moving pages between CMSs, and SEOs fixing crawl errors reported in Search Console.

SEO tip

After deploying, crawl your own site with a link checker — a redirect loop or 404 at the end of a chain will show up immediately, and Google reports those as crawl errors days later.

Frequently asked questions

One hop is ideal, two is tolerable, three or more wastes crawl budget and page speed — Google may stop following the chain entirely.
Yes, eventually, but rendering is required and often delayed. Treat JavaScript redirects as a no-JS fallback only.
A single 301 adds one round-trip (tens of ms). A chain of five adds five — noticeable on mobile networks, and cumulative across a crawl.

Related tools

Guides for this tool