Redirect Generator
Enter old and new addresses to get redirect code for Apache, Nginx, Next.js and more.
This tool generates the redirect rules you need after a site move or an address change. Paste old and new addresses line by line or as CSV, then pick a type for each pair: 301 for permanent, 302 for temporary, and 307 or 308 as variants that preserve the request method; ready made rules cover switching from http to https, moving between www and the bare domain, adding or removing a trailing slash, and carrying every path from an old domain over to a new one.
The output comes in six tabs: `.htaccess` for Apache with RewriteRule and Redirect lines, `location`/`return` blocks for Nginx, a `redirects()` array for Next.js, a `_redirects` file for Netlify, a `vercel.json` for Vercel, and a bulk redirect CSV for Cloudflare. The tool spots chains (A to B, then B to C) and suggests collapsing them into one hop, flags loops (A to B, B back to A) as an error, warns when one source points to two different targets, and calls out addresses with query strings or characters that need escaping in regular expressions.
301 tells search engines a page has moved permanently and to remember the new address instead of the old one; 302 and 307 mark the move as temporary, while 308 stays permanent like 301 but preserves the original request method such as GET or POST. This tool only produces code for you to paste in, it does not upload anything to your server or hosting panel; test the rules in a staging environment or on a few addresses before going live. Use the redirect audit tool to confirm whether the old or new address resolves.
FAQ
Should I use 301 or 302?
Use 301 when the page has moved for good, and 302 when the change is only temporary; search engines treat 301 as a permanent address change. Pick 308 or 307 instead if keeping the original request method matters.
Why is a redirect chain a problem?
If address A redirects to B and B redirects to C, both visitors and search engines have to follow two hops, which slows the page down. The tool flags this and suggests writing a single rule straight from A to C.
Is the address list I enter stored anywhere?
No, all the matching and code generation happens in your browser, no address is sent to our server. Leaving the page clears the list.
Can I add the generated code straight to my live site?
You can, but test it in a staging environment or on a few addresses first to confirm it behaves as expected. A rule written incorrectly can make an entire site or specific pages unreachable.
