Canonical & Redirect Chain Matrix Mapper (301 vs 308 Decision Engine)
Master regex specifications and configuration rules for Nginx, Cloudflare and Next.js. Detect redirect chains and preserve query parameters during site migrations.
Redirect Decision Engine & Server Rule Generator
Evaluates URL migration paths, determines 301 (Permanent) vs 308 (Permanent + POST preservation) status codes, tests query string regex rules, and compiles turnkey Nginx, Apache .htaccess, and Cloudflare rules.
Canonical & Redirect Chain Matrix Mapper (301 vs 308 Decision Engine) Configurator
Migration & Protocol Routing — 301 vs 308 Decision Engine
Redirect matrix mapping legacy paths to canonical destinations with HTTP status code validation and multi-platform syntax generation.
1 Input Parameters & Assumptions
| Parameter | Value | Context & Provenance |
|---|---|---|
| Total Redirect Rules | 3 Rules Configured Paths | Migration mapping rules |
| Permanent Rules (301/308) | 2 Rules Permanent | Passes 100% Link Equity / PageRank |
| Temporary Rules (302/307) | 1 Rule Temporary | Seasonal promotional redirect |
2 Explicit Mathematical Formula
Rule Set Evaluation: 3 active migration rules
Rule 1: /old-blog/post-1 -> /blog/post-1 (301 Permanent, Query: Preserved)
Rule 2: /api/v1/checkout -> /api/v2/checkout (308 Permanent, Query: Preserved, Method: Preserved)
Rule 3: /promo-2024 -> /offers (302 Temporary, Query: Dropped)
Permanent vs Temporary Ratio: 2 Permanent (66.7%) / 1 Temporary (33.3%)
Output Syntax Generation: Next.js next.config.js, Nginx nginx.conf, Apache .htaccess, Cloudflare Bulk CSV3 Computed Output Metrics
| Computed Metric | Result | Interpretation & Threshold |
|---|---|---|
| Configured Mappings | 3 Routes | Total URL mappings validated and formatted for deployment |
| HTTP 308 POST Preservation | Active (Rule 2) Status Code | Guarantees HTTP POST request bodies are preserved without 301 GET method conversion |
| Multi-Platform Export | Next.js / Nginx / Apache Platforms | Generates production-ready config snippets matching target server infrastructure |
Canonical & Redirect Chain Matrix Mapper (301 vs 308 Decision Engine) — Scope & Limitations
Explicit operational boundaries and constraints defining target use cases and out-of-scope scenarios.
Built For (Target Use Cases)
- Mapping source-to-target URL redirect rules with a status code and query-preservation flag.
- Detecting circular loops and multi-hop chains among the redirect rules entered.
- Exporting equivalent Nginx, Apache .htaccess, Next.js, and Cloudflare CSV redirect syntax.
Not Built For (Limitations & Out-of-Scope)
- Testing live redirects on a real server; all checks run against entered rules only.
- Detecting chains that involve existing server redirects not entered into the tool.
- Choosing a status code automatically; 301, 308, 302, and 307 are manual choices.
Operational Assumptions & Defaults
- Loop and chain detection compares only the source and target paths already listed.
- New rules default to a leading slash and a 301 status code unless changed.
- Preserve-query and status-code choices are set by the user, not inferred from URL structure.
Canonical & Redirect Chain Matrix Mapper (301 vs 308 Decision Engine)
Technical SEO & Crawl BudgetMap source and destination URLs, detect multi-hop redirect chains and circular loops, and transpile redirect rules across Nginx, Apache .htaccess, Next.js, and Cloudflare.
Redirect Rules Matrix (3)
location = /old-blog/post-1 {
return 301 /blog/post-1$is_args$args;
}
location = /api/v1/checkout {
return 308 /api/v2/checkout$is_args$args;
}
location = /category/shoes-old {
return 301 /category/footwear$is_args$args;
}Deploy Nginx / Apache / Cloudflare Redirects
Copy the generated server configuration block directly into your Nginx conf.d, Apache .htaccess file, or Cloudflare Dynamic Redirects dashboard.
When to Use 301 versus 308 Redirects
HTTP 301 permits user agents to rewrite a POST request to GET on redirect. HTTP 308 requires user agents to preserve the original HTTP method. In Next.js App Router and modern API architectures, 308 ensures form submissions and webhooks survive redirection without data loss.
Implementation Code & Script
Type-safe redirect configuration handling trailing slashes, uppercase normalisation, and legacy URL patterns.
import type { NextConfig } from 'next';
const nextConfig: NextConfig = {
trailingSlash: false,
async redirects() {
return [
{
source: '/legacy-blog/:slug',
destination: '/article/:slug',
permanent: true, // 308 permanent redirect
},
{
source: '/resources/tools/:slug',
destination: '/resources/gtm-analytics/:slug',
permanent: true,
},
];
},
};
export default nextConfig;Downloadable Package Assets & Templates
Master spreadsheet template for mapping 301 vs 308 redirects, preserving query strings, and validating regex destination paths during site migrations.
Redirect Status & Chain Verification Guide
Verify with cURL terminal commands that redirects resolve in exactly 1 hop (no 301 -> 301 chains) and maintain query parameters.
Pre-Production Verification Checklist
Ensure legacy URLs resolve to final 200 destination in exactly one 301/308 hop.
Verify UTM parameters and gclid are passed intact across the redirect boundary.
Confirm HTTP -> HTTPS and non-slash -> slash normalization occur in a single unified rule.
Terminal Diagnostic & Debug Commands
Prints status code and destination URL verifying single-hop execution.
curl -ILs -o /dev/null -w "%{http_code} -> %{url_effective}\n" https://example.com/old-category/item-1?utm_source=testFailure Remediation & Troubleshooting
Cause: Legacy URL redirects to non-HTTPS or missing trailing slash before reaching canonical URL.
Fix: Point all source rules directly to the absolute canonical target URL (https://example.com/target/).
Cause: HTTP 301 allows user agents to mutate POST requests to GET, stripping the payload body.
Fix: Use HTTP 308 Permanent Redirect for all REST API endpoints to enforce POST method retention.
How to cite and attribute this tool
MIT LicenceThis resource is free, open and un-gated under the MIT Open Source Licence. You are encouraged to use, integrate and cite it with attribution:
@misc{geraghty_redirect_chain_matrix,
author = {Geraghty, Gordon},
title = {Canonical & Redirect Chain Matrix Mapper (301 vs 308 Decision Engine)},
year = {2026},
url = {https://gordongeraghty.com/resources/technical-seo/redirect-chain-matrix},
note = {Head of Performance Media, Empire Amplify}
}Changelog & Version History
v1.0.0Initial release of regex redirect matrix and 301 vs 308 decision guide.
Strategic Takeaway & Operational Guidelines
For API endpoints and form POST actions, HTTP 308 is mandatory to prevent browsers from converting POST requests into GET requests. Use 301 for standard content migrations to pass full SEO link equity.