The Problem
BigCommerce has a built-in URL redirect manager — but only for Stencil storefronts. When you go headless with Next.js, that tool disappears. There's no admin interface, no redirect API that works with headless routing, nothing. Your SEO team and marketing team have no way to manage redirects without a developer editing code and redeploying.
Pantone runs 10 multilingual sites across 4 regions. URLs change — products get renamed, pages get reorganized, campaigns end, legacy paths from the old site still get traffic. Without a redirect system, every stale URL is a 404 and a lost visitor.
What I Built
A complete redirect management system with two parts: an admin editor in Control Booth and a Next.js middleware engine that processes redirects on every request.
The Admin Editor
A dedicated panel inside Control Booth where employees manage all redirect rules. Each redirect has:
- Source path — the old URL being redirected
- Destination path — where it should go
- Status code — 301 (permanent) or 302 (temporary)
- Locale scope — applies to all sites, a specific region, or a single locale
- Active toggle — disable a redirect without deleting it
Employees can create, edit, search, and bulk-manage redirects. Changes write to Aurora via Lambda and take effect on the next request — no rebuild, no redeployment needed.
The Middleware Engine
A Next.js middleware function that runs on every incoming request:
- Checks the request path against the redirect database
- Matches locale-specific redirects first, then global redirects
- Returns the appropriate 301 or 302 response
- Falls through to normal routing if no redirect matches
The redirect data is cached in-memory with a configurable TTL to avoid hitting the database on every request. Cache invalidation happens automatically when the TTL expires — employees see their changes take effect within minutes.
Technical Complexity
Middleware performance. This code runs on every single request to every page across all 10 sites. It has to be fast. The redirect lookup uses an in-memory Map for O(1) path matching. The cache refresh runs asynchronously so it never blocks a request — if the cache is stale, the current request uses the old data while a background refresh happens.
Locale-aware matching. A redirect from /old-page to /new-page needs to work differently depending on which of the 10 sites it's on. The matching logic checks for locale-specific redirects first (e.g., only redirect on the French site), then falls back to global rules. This prevents redirect conflicts across regions.
No rebuild required. Unlike next.config.js redirects which are compiled at build time, this system is fully dynamic. Marketing can respond to SEO issues in minutes, not hours.
Wildcard and pattern support. Beyond exact path matching, the system supports trailing wildcard redirects — redirect /old-section/* to /new-section/*, preserving the path suffix. This handles entire site sections being reorganized.
Results
Pantone's marketing and SEO teams can manage URL redirects independently, without filing development tickets or waiting for deployments. The system handles the entire redirect lifecycle — from a product page rename to a full site section reorganization — across all 10 multilingual sites from a single admin interface.
Tech Stack
Next.js 15, TypeScript, Next.js Middleware, AWS Lambda, API Gateway, Aurora DB, Control Booth Admin UI
