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.
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;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:
Geraghty, G. (2026). Canonical & Redirect Chain Matrix Mapper (301 vs 308 Decision Engine). Gordon Geraghty Resources Hub. https://gordongeraghty.com/resources/technical-seo/redirect-chain-matrix
BibTeX Format
@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, Empire Amplify}
}Changelog & Version History
v1.0.0Initial release of regex redirect matrix and 301 vs 308 decision guide.