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
- Pick the status code: 301 for permanent moves, 302/307 only if the old URL returns soon.
- Choose the server format you will paste into.
- Enter the old path and the new absolute URL.
- Copy the snippet to the right file — for Apache that is
.htaccessat the site root.
Which status code?
| Code | Means | Equity | Use when |
|---|---|---|---|
| 301 | Moved permanently | Transfers | Page is gone for good (default choice) |
| 302 / 307 | Temporarily elsewhere | Not transferred | Maintenance, A/B test, geo swap |
| 308 | Permanent, method kept | Transfers | APIs 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.