LaunchRanked

301 redirect generator

Paste old and new URLs, one pair per line. Get redirect rules for your server or host, checked for loops, chains and duplicates.

Separate with a space, comma, tab (paste two spreadsheet columns) or ->. Add 301, 302, 307 or 308 as a third column to override the status for one line.

Turns full URLs on your site into paths. Cloudflare needs it for the hostname.

Status code

Paste old and new URLs. You get rules for Apache, Nginx, Vercel, Netlify, Next.js and Cloudflare, with checks for loops, chains, duplicates and sources that can’t be matched.

What each platform file does

  • Apache (.htaccess). Per the mod_alias docs, Redirect matches by prefix and appends the rest of the path, so Redirect 301 /old /new also sends /old/page to /new/page. We default to RedirectMatch 301 ^/old/?$ /new with the path regex-escaped, which matches only that page. Prefix mode is there for moving whole sections.
  • Nginx. One location = /old { return 301 /new; } per rule, for the server block. return doesn’t append the query string, hence $is_args$args. Run nginx -t before reloading.
  • Vercel and Next.js. permanent: true sends 308 and false sends 307; statusCode gives a literal 301 or 302, never both on one entry (Vercel, Next.js). The characters ( ) { } : * + ? have meaning in source, so we escape them. Vercel caps configuration redirects at 2,048; above that, use the bulk CSV with bulkRedirectsPath.
  • Netlify (_redirects). /old /new 301, first match wins, and the docs list 301 and 302 (307 is unsupported, so we map it). Add ! to redirect even when a file still exists at the old path.
  • Cloudflare Bulk Redirects. A CSV with no header row: source, target, status, preserve query string (format docs). Sources are host plus path with no scheme, so they match http and https.

Checks before you ship

Sources with a query string or #fragment are skipped, since path rules can’t match them. Duplicate sources are merged, and conflicting ones keep the first rule: most platforms stop at the first match, and Nginx refuses duplicate locations outright. A rule that points at itself is a loop and is dropped, as is any cycle like A→B→A. Chains are reported and, with flattening on, collapsed to one hop.

After deploying

Test a few old URLs with the redirect checker to see every hop and the final status. Then update internal links and your sitemap to the new URLs, so crawlers don’t keep requesting old ones: the broken link checker and the XML sitemap generator help. Google’s redirects guide lists 301 and 308 together as “moved permanently”, so either is fine for a page that has moved for good.

Questions

301 or 308: which is better for SEO?

For Google it doesn't matter. Google's redirect docs group 301 and 308 as permanent redirects and use both as a signal that the target should be canonical. 302 and 307 are temporary: Google follows them but doesn't treat the target as canonical. Next.js and Vercel default to 308/307 because those also keep the request method.

Why can't I redirect a URL with a query string?

Path-based rules (Apache Redirect and RedirectMatch, Nginx location, Vercel and Next.js source, Netlify paths, Cloudflare Bulk Redirects) match the path only. /page?id=3 and /page?id=4 hit the same rule. Redirecting by query value needs a platform-specific feature, such as Next.js 'has' conditions, Netlify query parameter matching or Apache mod_rewrite.

What does flattening chains do?

If /a goes to /b and /b goes to /c, visitors and crawlers make two hops. Flattening rewrites the first rule to /a → /c and keeps /b → /c, so every old URL lands on the final page in one step.

Is the query string kept?

Apache mod_alias, Netlify (301 and 302), Vercel and Next.js configuration redirects pass it through. Nginx's return doesn't, so we add $is_args$args when the toggle is on. Cloudflare Bulk Redirects and Vercel bulk redirects have an explicit preserve-query setting, which the toggle controls.

Autopilot · early access

Want this fixed automatically?

Autopilot checks your site, publishes researched articles at a safe pace, and tracks whether ChatGPT, Perplexity, Gemini and Claude cite you. $49/mo.

Related free tools

See all free tools