301 redirect mapping tool for website redesigns
Under contract · Mediapilote● Live
A Next.js tool that crawls the old and new sites of a redesign, matches URLs by algorithm then by AI, and exports the 301 redirect plan as CSV or .htaccess.
Context
During a website redesign, every old URL must point to the right page on the new site through a 301 redirect, or the search rankings built over time are lost. Building that redirect plan by hand, URL by URL, quickly gets long once a site has a few hundred pages.
I built an internal tool for Mediapilote that compares the old and new sites and suggests matches to validate.
Challenge
URLs rarely change in predictable ways: rewritten slugs, a new structure, dropped file extensions. A plain string comparison leaves many pages unmatched, or matched to the wrong one.
The tool also had to handle large sites, some of which only render with JavaScript, and leave the final say to the person validating the plan.
Approach
I wrote the application in Next.js and TypeScript. A crawler discovers pages from sitemaps, compressed or not, with concurrency and politeness delays, and hands JavaScript-rendered sites to a Chromium service. Matching combines URL normalisation, segment splitting, stemming, synonyms and Levenshtein distance, with an indexed mode for large volumes.
Uncertain matches go through an AI refinement step, which has become full matching on Gemini run as a background job, with a history of analyses. Lists are imported as CSV, the plan is exported as CSV or .htaccess, and access is protected by NextAuth.
(04) — Results
Key figures- 30
- commits
- 6
- months of development
- 3
- matching modes: algorithmic, indexed, AI
- 2
- export formats: CSV and .htaccess
