Guide

THE TOOLBOX / ROUTING & EDGE INFRASTRUCTURE

Compile & test
301/308 redirect rules.

Transpile wildcard and regex redirect rules across Nginx, Apache .htaccess, Cloudflare _redirects, Vercel, and Next.js with live capture-group simulation.

REDIRECT RULE BUILDER & URL TESTER
Match Result: ✓ MATCHED (301) → /articles/2026/technical-seo?ref=rss
TRANSPILED SERVER CONFIGHTTP 301

Compiled 301 rule for NGINX.

THE DETAILS

RFC 9110 / RFC 7538 redirect semantics, cross-server regex transpilation, and loop detection.

1. Multi-Platform Syntax Compiler

Every edge router and web server uses slightly different wildcard and backreference syntax. Define your source and destination once and switch tabs between Nginx (`rewrite` / `return`), Apache (`.htaccess`), Cloudflare Pages (`_redirects`), Vercel (`vercel.json`), and Next.js (`next.config.ts`).

2. Live Capture-Group URL Sandbox

Test candidate URLs with query strings against your rule before touching production configs. The simulator extracts `$1` / `$2` / `:splat` capture groups and displays the exact resolved destination URL.

3. Self-Redirect Loop Prevention

A classic migration outage occurs when `/docs/*` redirects to `/docs/archive/$1`—which matches `/docs/*` again on the next request (`ERR_TOO_MANY_REDIRECTS`). Our simulator checks whether the destination re-triggers the source pattern.

4. Query String & Trailing Slash Hygiene

Toggle query-string preservation (`QSA` in Apache, `?` suffix in Nginx) and HTTPS / trailing-slash canonicalization. Need to inspect query parameters or test complex JavaScript regular expressions? Use the URL Inspector & Slug Builder or Regex Tester.

Cross-Platform Redirect Syntax Comparison Matrix

Server / Edge PlatformSource Wildcard SyntaxTarget Backreference301 Permanent Flag
Nginx (nginx.conf)^/blog/(.*)$/articles/$1permanent; or return 301
Apache (.htaccess)^blog/(.*)$ (no leading /)/articles/$1[R=301,L,QSA]
Cloudflare / Netlify (_redirects)/blog/*/articles/:splat301
Vercel / Next.js/blog/:path*/articles/:path*permanent: true / statusCode: 301

Common Redirect Migration Pitfalls & Troubleshooting

Multi-Hop Redirect Chains

Redirecting http:// → https:// → non-trailing-slash → new slug creates a 3-hop chain that adds latency and dilutes crawl budget. Point legacy rules directly to the final canonical URL.

Browser Caching of Accidental 301s

Browsers cache 301 Moved Permanently responses indefinitely in disk cache. When testing new rules in staging, deploy with 302 first and switch to 301 once verified.

POST Webhook Body Loss on 301/302

If you move an API webhook endpoint that receives POST requests, use 308 Permanent Redirect or 307 Temporary Redirect so HTTP clients do not downgrade the request to GET.

Rule Ordering Priority

Nginx, Apache, and Cloudflare evaluate redirect rules top-to-bottom. Always place specific exact-path redirects above broad catch-all wildcard rules.

Frequently Asked Questions

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

301 (Moved Permanently) and 308 (Permanent Redirect) transfer SEO ranking signals to the destination URL permanently, while 302 (Found) and 307 (Temporary Redirect) signal a temporary move. Historically, browsers converted POST requests into GET requests on 301/302 redirects; RFC 7538 introduced 308 and 307 to guarantee that the HTTP method and request body remain unchanged.

Why does Apache .htaccess omit the leading slash in RewriteRule patterns?

In per-directory Apache .htaccess files, mod_rewrite strips the directory prefix (including the leading /) before matching RewriteRule patterns. Therefore, a rule matching /blog/post must be written as ^blog/(.*)$ in .htaccess, whereas Nginx rewrite directives always match against the leading slash (^/blog/(.*)$).

How do Cloudflare Pages and Netlify _redirects handle wildcards?

In a static _redirects file, an asterisk (*) in the source path matches any remaining path segments and maps them into the :splat placeholder in the destination URL (for example: /blog/* /articles/:splat 301).

How do I prevent Nginx or Apache from dropping query parameters on redirect?

Nginx automatically appends the original query string on rewrite rules unless you add a trailing question mark (?) to the destination. In Apache mod_rewrite, include the QSA (Query String Append) flag ([R=301,L,QSA]) whenever your destination pattern contains its own query parameters.

How does the infinite redirect loop detector work?

When you test a URL in the live simulator, the engine resolves the target destination path and re-evaluates it against your source pattern. If the resolved destination still matches the source pattern (for example, redirecting /docs/* to /docs/v2/$1), it warns you before deployment.