Turn a list of old and new URLs into .htaccess, Nginx or Netlify redirect rules.
Generated in your browser — test on staging before deploying.
What is the difference between a 301 and a 302 redirect?
A 301 is permanent and passes the old page’s ranking signals to the new URL; a 302 is temporary and keeps the original URL indexed. Use 301 for migrations. Avoid chains: if A redirects to B and B to C, repoint A straight at C, since each hop wastes crawl budget.
Understanding your result
Use 301 for anything permanent: it tells search engines the move is final and passes the old page’s ranking signals to the new URL. A 302 says the change is temporary, so the old URL stays indexed — useful for a short campaign, wrong for a migration. The detail most people miss is chains. If A redirects to B and B later redirects to C, every visitor and crawler makes two hops, which wastes crawl budget and dilutes the signal passed along. Whenever you add a new redirect, check whether its target is itself already redirected and repoint the original straight at the final destination. One more practical warning: a syntax error in .htaccess takes down the whole site with a 500, so always test on a staging copy.
Formula and method
Apache rules take the form RewriteRule ^old-path$ /new-path [R=301,L], where ^ and $ anchor the match to the whole path. Nginx uses location = /old-path { return 301 /new-path; }, and Netlify-style hosts use a plain “from to code” line.
Assumptions and limitations
These are exact-match rules, one per URL — wildcard and pattern-based redirects, query-string matching and conditional rules by hostname or language are out of scope and need hand-written configuration. The generator cannot verify that your target URLs actually exist or return 200. Always test on staging first: a malformed .htaccess returns a 500 error for the entire site, not just the redirected pages.
Worked example
Four redirects — including one from a full https:// URL and one to an external domain — produce four anchored rules wrapped in an IfModule block, ready to paste at the top of .htaccess.
How to use this tool
- List your redirects, one “old URL, new URL” pair per line.
- Choose your server type and status code.
- Fix any redirect chains the tool flags.
- Test on staging, then deploy the rules.
Common mistakes to avoid
- Using 302 for a permanent move, so the old URL keeps the rankings.
- Leaving redirect chains in place instead of flattening them.
- Forgetting to escape dots, so ^page.html matches more than intended.
- Redirecting everything to the homepage instead of the closest equivalent page.
About the 301 Redirect Generator
The 301 Redirect Generator converts a list of old and new URLs into ready-to-paste redirect rules for Apache, Nginx or Netlify-style hosts. It normalises full URLs down to paths, escapes regex characters, removes duplicates and flags redirect chains before you deploy.
Who should use this tool
Anyone migrating a site, restructuring URLs or cleaning up after a redesign.
Benefits
- Three server formats from one list.
- Escapes dots and other regex characters that would otherwise match too broadly.
- Detects redirect chains, which quietly waste crawl budget.
- Accepts full URLs, paths, commas, tabs or arrow separators.
Practical use cases
- Migrating to a new URL structure without losing rankings.
- Redirecting old .html pages to clean URLs after a rebuild.
- Consolidating duplicate or retired pages.
- Pointing legacy campaign URLs at their current equivalents.
Explore all SEO and Website Tools tools
Frequently asked questions
What is the difference between a 301 and a 302?
A 301 is permanent and transfers ranking signals to the new URL. A 302 is temporary and tells search engines to keep the original URL indexed.
Why do redirect chains matter?
Each hop costs crawl budget and dilutes the signal passed on. If A points to B and B points to C, repoint A directly at C.
Where do I put the .htaccess rules?
Near the top of the .htaccess file in your site root, before other rewrite rules, so they are evaluated first.
How long should I keep redirects in place?
At least a year, and ideally permanently. Search engines need repeated crawls to consolidate the change, and old links elsewhere on the web never expire.
Can I redirect to another domain?
Yes. Enter a full https:// URL as the target and the rule will point across domains.