Skip to content

Redirect Generator

Generate 301, 302, 307 and 308 redirect rules for Apache .htaccess, Nginx, Netlify _redirects and Vercel vercel.json — single or in batch.

Web & SEO Runs client-side Free to use
Jump to the tool
Share: X WhatsApp
Loading Redirect Generator…

About the Redirect Generator

Redirect Generator writes redirect rules for four common platforms: Apache .htaccess (mod_rewrite), Nginx, Netlify _redirects and Vercel vercel.json. Enter an old path or URL and its new destination, choose 301, 302, 307 or 308, and copy or download the code for the platform you use.

Batch mode accepts one redirect per line, skips invalid lines with a line-specific explanation, and still generates all valid ones. Where a platform does not support a choice — for example Netlify’s documentation lists 301 and 302 but not 307 for redirects — the tool says so instead of producing a rule that would fail. It only generates text; nothing is live until you deploy the code to your own hosting.

How to use

  1. Choose Single redirect, or Batch to paste one redirect per line in the form “old new” or “old new status”.
  2. Enter the old value as a path (/old-page) or a full URL (https://old.example.com/old-page), and the new value as a path or full URL.
  3. Pick the default status: 301 or 308 for permanent moves, 302 or 307 for temporary ones.
  4. Choose whether Apache and Nginx should keep the visitor’s query string, then select the platform tab.
  5. Copy or download the code, add it to your server or project configuration, test it, then deploy.

Key features

  • Output for Apache .htaccess, Nginx, Netlify _redirects and Vercel vercel.json, one platform at a time.
  • Status choices: 301 Permanent, 302 Temporary, 307 Temporary and 308 Permanent.
  • Clear distinction between path-only values and full http(s) URLs, including host-specific rules.
  • Query-string handling for Apache (QSA / QSD) and Nginx ($args); notes for platforms that pass query strings automatically.
  • Batch mode with per-line validation — invalid lines are skipped, valid lines still generate.
  • Loop detection, safe escaping of special characters, Copy and Download.

Best practices

  • Use permanent redirects (301 or 308) only when the move really is permanent.
  • Redirect each old URL straight to its final destination to avoid redirect chains.
  • Back up your existing .htaccess, Nginx config or vercel.json before adding rules.
  • Test on a staging site — for Nginx run “nginx -t” before reloading.
  • Update internal links and your sitemap to the new URLs as well.

Benefits

  • Correct syntax for four platforms without memorising each format.
  • Handles dozens of redirects at once during a site migration.
  • Explains platform limits instead of generating rules that silently fail.
  • Runs locally — your URL lists stay private.

Frequently asked questions

Does this tool set up the redirect for me?

No. It only generates configuration text. A redirect works only after you add the code to your own server or hosting configuration and deploy it.

What is the difference between 301, 302, 307 and 308?

301 and 308 are permanent; 302 and 307 are temporary. 307 and 308 also require browsers to keep the original request method (for example POST), while 301 and 302 may change it to GET.

Why is there no Netlify output for 307 or 308?

Netlify’s _redirects documentation lists 301 and 302 for redirects and states that 307 is currently unsupported, so the tool asks you to choose 301 or 302 for Netlify.

What does “preserve query string” do?

For Apache and Nginx it keeps parameters such as ?ref=abc when redirecting. Netlify (for 301/302) and Vercel pass query strings through automatically, so the setting does not change their output.

Can the old address include a query string?

No. These rules match on the path only, so the old value cannot contain ?query or #fragment. The new value can include a query string.

What format does batch mode use?

One redirect per line: old value, new value and an optional status, separated by spaces, tabs or a comma. Lines starting with # and blank lines are ignored.