Redirect Rule Generator
Turn a list of old and new URLs into ready-to-paste redirect rules for your server or host. Invalid lines, duplicate sources, chains and loops are reported before they go live.
Status code
How to use it
Put one redirect per line: the old URL first, then the new one. Copying two columns from a spreadsheet gives you tab-separated lines, which work as they are. Commas and spaces work too. The old URL can be a path such as /old-page or a full URL. Lines that start with # are ignored.
The output formats
- Apache Redirect: short and readable, matches by path prefix. Goes into
.htaccessor the virtual host. - Apache RewriteRule: exact matches with escaped patterns. The only server format here that can match a query string, through a
RewriteCondline. - Nginx location: one
location = /pathblock per URL. Exact match, easy to read, fine for up to a few hundred rules. - Nginx map: one lookup table in the
httpblock plus a singleifin the server block. The better choice for long lists. - Cloudflare bulk redirects: a CSV for the Bulk Redirects import. Cloudflare wants full URLs on both sides, so enter your site origin.
- Netlify: the
_redirectsfile in your publish folder. - Vercel and Next.js: a
redirectsarray forvercel.jsonornext.config.js. Query strings becomehasconditions.
What gets checked
- Invalid lines: a missing second value, more than two values, or a URL that starts with neither
/norhttp. - Duplicates: the same old URL twice. Servers use the first matching rule, so the second one would never run. You get an extra note when the two targets differ.
- Chains and loops: a new URL that is itself redirected, and rules that lead back to where they started.
After you deploy the rules
Test a few old URLs with the redirect checker to see the real status code and every hop, or check a whole list with the HTTP status checker. Then update internal links and the sitemap so they point at the new URLs. The sitemap generator builds a fresh file from your list of new URLs.
Keep permanent redirects in place for at least a year. Google needs to recrawl the old URLs to notice the move, and other sites will keep linking to them. If the new pages are slow to appear in search, TurboIndex can submit them to Google for you.
Questions and answers
Should I use 301 or 308, 302 or 307?
301 and 308 are permanent, 302 and 307 are temporary. Google treats both permanent codes as a signal that the new URL should replace the old one in search results. The difference is technical: 307 and 308 force the browser to repeat the request with the same method, so a POST stays a POST. For normal page moves 301 is the usual choice. Next.js and Vercel use 308 and 307 by default.
What is a redirect chain and why does it matter?
A chain exists when the new URL of one rule is the old URL of another rule: A goes to B and B goes to C. Every hop costs a round trip for visitors, and Googlebot follows only a limited number of hops before it gives up (Google's documentation mentions up to 10). Point A straight at C. The Flatten chains switch does that for you.
Why does the Apache Redirect format also match sub-pages?
The Redirect directive of mod_alias matches by path prefix. Redirect 301 /old /new also sends /old/page to /new/page. That is handy for folders and surprising for single pages. If you need exact matches, use the RewriteRule format, where every pattern is anchored with ^ and $.
Which characters are escaped?
In RewriteRule patterns every regular expression metacharacter in your path is escaped, for example the dot in /page.html, so it only matches a real dot. In the RewriteRule target, $ and % are escaped because Apache reads them as backreferences. For Next.js and Vercel the characters ( ) { } : * + ? are escaped, because the source field uses path-to-regexp syntax.
Are my URLs sent to a server?
No. The rules are built in your browser. Nothing is uploaded or stored.