consolelog.tools

Redirect Rule Generator

Generate redirect rules for Apache, Nginx, Next.js, Vercel, Netlify, and Cloudflare

About this ToolHow it works, benefits & use cases

The Redirect Rule Generator turns a list of from/to mappings into ready-to-deploy redirect configuration for six platforms: Apache (.htaccess), Nginx (nginx.conf), Next.js (next.config.js), Vercel (vercel.json), Netlify (_redirects), and Cloudflare Pages (_redirects). Add as many rules as you need, each with a source path, a destination, and a redirect type — 301, 302, 303, 307, or 308 — with an inline description of what each status code means and when to use it. Common-pattern chips drop in frequently-needed rules like HTTP-to-HTTPS, www/non-www canonicalisation, trailing-slash handling, and stripping .html extensions, including their regex sources. Before generating, every rule is validated: empty paths, identical source and destination, and likely redirect chains are flagged as errors or warnings, and using a 302 for what looks like a permanent move prompts a 301 suggestion. The output panel emits the file with the correct name and MIME type so you can copy or download it straight into your project.

How to Use

  1. 1Select your Server / Platform (Vercel, Netlify, Next.js, Apache, Nginx, or Cloudflare Pages).
  2. 2Optionally click a Common patterns chip to append a ready-made rule such as HTTP to HTTPS or WWW to Non-WWW.
  3. 3Fill each rule’s From path and To path, and choose the redirect type from the dropdown (the description updates below it).
  4. 4Use "Add rule" for more mappings or the trash button to remove one; "Reset all" clears everything.
  5. 5Press "Generate redirect rules", fix any validation errors shown on the rules, then copy or download the generated config file.

Key Benefits

  • One rule set, six platform outputs: Apache, Nginx, Next.js, Vercel, Netlify, and Cloudflare
  • Supports all five common redirect status codes (301, 302, 303, 307, 308) with inline guidance
  • Common-pattern chips for HTTPS forcing, www canonicalisation, trailing slashes, and .html removal
  • Per-rule validation catches empty paths, source-equals-destination, and probable redirect chains
  • Warns when a 302 is used where a 301 would be better for SEO
  • Downloads with the right file name per platform (.htaccess, nginx.conf, vercel.json, _redirects, and more)
  • Rules and output persist in your browser between visits

Common Use Cases

  • Migrating an old URL structure to a new one without losing SEO equity
  • Generating a vercel.json or next.config.js redirects block for a deployment
  • Producing an Apache .htaccess RewriteEngine block for legacy shared hosting
  • Forcing HTTPS and a single canonical host across an entire site
  • Building a Netlify or Cloudflare Pages _redirects file from a batch of moved pages

Platform settings

Common patterns

Redirect rules

Rule 1

Permanently moved. Best for SEO, passes PageRank.

Run to generate your redirect configuration.

Redirect best practices

  • Use 301 redirects for permanently moved content
  • Use 302 redirects only for temporary moves
  • Avoid redirect chains (A -> B -> C)
  • Update internal links instead of relying on redirects
  • Test redirects before deploying to production
  • Monitor redirect performance and fix slow chains

Redirect type guide

301Permanent Redirect

Use when permanently moving content

302Temporary Redirect

Use for temporary moves or A/B testing

303See Other

Use after POST requests

307Temporary Redirect (HTTP/1.1)

Similar to 302 but preserves HTTP method

308Permanent Redirect (HTTP/1.1)

Similar to 301 but preserves HTTP method

Was this tool helpful?

Share Your Experience

Help others discover this tool!

Related tools