redirect-map-check
Check a website migration's redirects before and after launch. Give it the old sitemap and your redirect map; it follows every old URL and tells you which ones end in a 404, loop, chain through several hops, use a temporary redirect, land on the homepage or an unrelated page, or are missing from the map altogether.
npx redirect-map-check --sitemap https://www.example.com/sitemap.xml --map redirects.csv
You get a short summary in the terminal, plus a CSV and an HTML report listing every problem with a recommended fix for each one.
Prefer a browser to the terminal? npx redirect-map-check ui opens a page where you drop in the files and watch the check run. It all stays on your computer (details).
Why we built it
We're ITCrowd, and we move sites between platforms for a living: Webflow to Shopify, WordPress to custom code, one CMS to another. The redirect map is where migrations quietly lose traffic. A spreadsheet with a few hundred rows always has a typo, a target page nobody built, a rule that sends people to the homepage, or a 302 someone meant to be a 301. Search engines notice all of these.
We used to check them by hand. Now we run this before every launch and again the day after, and we've made it free for anyone doing the same job.
What it checks
For every old URL (from the sitemap, a URL list, and the map itself), we follow the redirects one hop at a time and look at where they end up.
| Problem |
Severity |
What it means |
unchecked |
error |
We couldn't check the URL: robots.txt on the site under test disallows us, or answers 5xx. Never counted as clean. |
fetch-error |
error |
DNS, TLS, timeout or connection failure, on the page or on its robots.txt. |
sitemap-unread |
error |
With --allow-partial-sitemaps: a child sitemap failed, so its URLs weren't checked. Fails the run even if everything else is clean. |
rate-limited |
error |
The server answered 429 and asked us to wait longer than 30 s. |
not-found |
error |
The chain ends in a 404 or 410. |
client-error / server-error |
error |
The chain ends in another 4xx, or a 5xx. A 503 is retried once first. |
redirect-loop |
error |
The redirects send the URL back to itself. |
too-many-redirects |
error |
More hops than --max-hops (default 10). |
redirect-without-location |
error |
A 3xx response with no Location header. |
non-http-redirect |
error |
A rule sends visitors to javascript:, mailto:, file: or similar. |
private-address |
error |
A redirect or sitemap entry leads into a loopback, private or link-local address. We don't request it (see "Security"). |
not-redirected |
error |
The URL is in the map but has no redirect: it still answers on its own (200, 404…). |
wrong-target |
error |
The redirect ends somewhere other than the URL in the map. |
lands-on-homepage |
error |
A deep URL ends on / (or a language root like /en/). Search engines treat this as a soft 404. |
map-conflict |
error |
The same old URL appears in the map twice with different targets. |
map-loop |
error |
Rows in the map send URLs to each other in a circle. |
check-failed |
error |
Something unexpected went wrong on this URL; the rest of the run carried on. |
redirect-chain |
warning |
More than one hop before the final page. |
temporary-redirect |
warning |
A 302, 303 or 307 where a migration needs a 301 or 308. |
target-variant |
warning |
Lands on the mapped page written differently (http/https, www, letter case, tracking parameters). Update the map. |
content-mismatch |
warning |
The new page's title and H1 share almost no words with the old page's. Usually a copy-paste slip in the map. |
mapped-to-homepage |
warning |
The map itself sends a deep URL to the homepage. |
map-chain |
warning |
A row points at an old URL that another row redirects again. |
missing-from-map |
warning |
An old URL has no row in the map and doesn't resolve to the same page. |
unchanged-not-in-map |
notice |
Not in the map, but still answers 200 at the same address. Fine if intended. |
page-incomplete |
notice |
The final page timed out or was cut off while downloading, so the title check used what arrived. |
target-not-checked |
notice |
The redirect leaves for another site whose robots.txt disallows us; the redirect was checked, the final page wasn't. |
map-self-target |
notice |
A row keeps the same URL. Fine as documentation; don't create a rule for it. |
map-duplicate |
notice |
The same row appears twice. |
map-row-skipped |
notice |
A row in the CSV didn't contain two URLs. |
One problem is reported once: a mapped URL with no redirect is not-redirected, not also not-found.
Every problem comes with a recommended fix written from what we saw: which rule to change, which map row to edit, whether the target page exists, and, where a page needs a new home, up to three candidate pages on the new site.
How the candidate pages are picked
Each new page is scored against the old one on two signals:
- Title and H1 words shared with the old page, ignoring words that appear on most pages (like the brand name).
- Slug words, from the last part of the URL (
/products/rattan-chair → rattan, chair). Slugs often survive a migration even when titles change.
With both signals the stronger counts 60% and the weaker 40%, so pages where they agree rank first. Scores of 0.75 and up are labelled strong; from --min-suggestion (default 0.5) up to 0.75, possible. Possible matches are worded as "check it before you use it".
To get the best suggestions:
- Give us the old titles. Run before launch with
--base (the old site is still live) and keep old-pages.json; after launch pass it with --snapshot. Without old titles we only have the slug, and every match is at most "possible" (one signal is never enough for "strong").
- Give us every new page.
--new-sitemap (or --new-urls with a plain list) lets us suggest pages nothing redirects to yet. Without it we only know the pages the crawl landed on. Check that the staging sitemap includes every CMS item and product.
- Let us read staging. On your own staging, add
--ignore-robots if robots.txt blocks crawlers.
- Specific titles help most. "Walnut writing desk" matches; "Product" or the brand name alone doesn't.
It compares words, not meaning: a page renamed to different words ("Linen sofa" → "Lino couch") or translated into another language won't be found, and near-identical pages (variants, pagination) can rank a sibling first. Treat suggestions as a shortlist for a person to confirm.
A URL counts as "clean" when it has no errors or warnings. A URL we couldn't check is an error, never clean, and the report's headline says how many there were. The exit code is 1 when anything at error level was found, so it drops straight into CI.
Worked example
The repository ships with a small demo: Harbor & Pine, a made-up furniture shop moving to a new site with new URLs. One local server plays the old live site (with its sitemap), another plays the new site on staging, and the staging redirect rules contain one mistake of each kind.
git clone <this repository> && cd redirect-map-check
npm run demo
That runs:
redirect-map-check \
--sitemap http://127.0.0.1:4101/sitemap.xml \
--map demo/redirect-map.csv \
--base http://127.0.0.1:4102 \
--new-sitemap http://127.0.0.1:4102/sitemap.xml
The map is an ordinary two-column CSV. Paths are fine; full URLs work too:
old_url,new_url
/about-us,/about
/products/walnut-desk,/shop/office/walnut-desk
/products/rattan-chair,/shop/living/rattan-armchair
/products/pine-bookshelf,/shop/dining/oak-dining-table
/delivery-information,/help/delivery
...
And the terminal summary:
redirect-map-check 19 URLs checked in 0.1s (67 requests)
Tested against http://127.0.0.1:4102
✖ 9 with errors ▲ 5 with warnings ✔ 5 clean
? 1 URL could not be checked at all; it counts as an error, never as clean.
Errors
1 unchecked Could not be checked
2 not-found Ends in a 404 / 410
1 server-error Ends in a 5xx server error
1 redirect-loop Redirect loop
1 not-redirected In the map, but not redirected
2 wrong-target Lands somewhere other than the mapped URL
1 lands-on-homepage Lands on the homepage
1 map-conflict Conflicting rows in the map
Warnings
2 redirect-chain Redirect chain (more than one hop)
2 temporary-redirect Temporary redirect (302 / 303 / 307)
2 content-mismatch Lands on an unrelated page
1 map-chain Map points at another old URL
1 missing-from-map Old URL missing from the map
Notices
1 unchanged-not-in-map Not in the map, still works
2 map-self-target Row keeps the same URL
1 map-row-skipped Map row skipped
Report: demo-report/report.html
CSV: demo-report/report.csv
Old pages: demo-report/old-pages.json (keep it: reuse after launch with --snapshot)
A few of the things it caught, with the fix it recommends:
/products/walnut-desk → 404. "The rule is right but /shop/office/walnut-desk doesn't exist. Publish /shop/office/walnut-desk, or point /products/walnut-desk (and row 6) at a live page."
/products/rattan-chair → homepage. "Change the rule for /products/rattan-chair to a 301 straight to /shop/living/rattan-armchair, which is live. It currently lands on /."
/products/pine-bookshelf → the oak dining table. The redirect does exactly what the map says, so a URL-only check passes it. The old page's title and H1 share no words with the new page's, so it's flagged: "Check row 10 of the map … A closer match on the new site is /shop/storage/pine-bookshelf, a strong match."
/blog/spring-collection loops. "/journal/spring-collection sends visitors back to /blog/spring-collection. Remove that rule, then redirect /blog/spring-collection once, with a 301, to /journal/spring-collection-2026."
/blog/caring-for-solid-wood takes two hops. "… The first hop only adds a trailing slash, so the migration rule never sees the original URL: make the rule match that form too, or put it first."
/cart is disallowed by staging's robots.txt, so it's an unchecked error, not a pass: "robots.txt on … disallows /cart, so we didn't request it. If you own the site (staging usually blocks crawlers), re-run with --ignore-robots."
/gift-cards is in the old sitemap, has no row in the map and 404s. "Add a row for /gift-cards to the map and a 301 to the page that replaces it. The closest live page we found is /shop/gift-vouchers, a strong match." /shop/gift-wrapping is listed as a possible second.
Each problem in report.html and report.csv also carries the full status chain, the expected URL and the final URL.
Browser interface
npx redirect-map-check ui
This starts a small server on your own computer (on 127.0.0.1, nobody else can reach it) and opens a page in your browser. On that page you:
- paste the old sitemap URL, or drop a saved sitemap or a list of URLs;
- drop the redirect map (CSV or TSV);
- add the staging URL and the new site's sitemap if you're testing before launch;
- press Run the check and watch each old URL being followed.
When it finishes you get the same results as the HTML report, but you can work through them: filter by errors, warnings or notices, pick one problem type, search URLs and fixes, and tick problems off as Done. The report, CSV, results.json and old-pages.json download from the page, or Save to folder writes them to ./redirect-report (or --out); it asks before replacing a report that's already there.
If your map lists only paths (/about, the usual Webflow or Shopify export), fill in the old site's address under the map. All the other options (delay, requests at once, timeout, hosts that belong to the new site and so on) are under More options.
Any command-line flag fills in the form, so you can start from a command you already use:
npx redirect-map-check ui --sitemap https://www.example.com/sitemap.xml --map redirects.csv --base https://staging.example.com --delay 1000
Files named on the command line (a saved sitemap, the map, --new-urls) stay on your machine: the page shows their names and a tick box to use them.
It listens on port 47470 (or a free one if that's taken), so Done marks are kept in your browser between sessions. --port <n> picks another port and --no-open prints the address instead of opening the browser. Stop it with Ctrl+C. To try it on the demo sites: npm run demo:ui.
On a normal command-line run, --open opens report.html in your browser when the check finishes.
How it stays private: