Tutorial · migration-hosting · Published 2026-08-15 · 3 min read
Building a redirect map for a site move
Building a redirect map for migration: capture all old URLs, assign one 301 target each and test the full set before the swap.
What a redirect map is
A redirect map is the complete list of old URL to new URL pairs you will serve after a URL migration. Its two rules are absolute:
- Every old URL appears exactly once as a source.
- Every source has exactly one target, and the target is a real new page, not a loop and not the root when a closer page exists.
The map is the raw material of every redirect mechanism. Import it verbatim into your host panel or your server config, and the site starts answering old URLs correctly the moment the migration flips.
Building the map from the old site
- Export the full old URL list (crawler or sitemap).
- For each URL, look up its new home. Three cases, one rule (from URL migration planning):
| Old URL | New URL | How to decide |
|---|---|---|
| /blog/2024/cat-health/ | /guides/cat-health/ | one-to-one if the page lives on |
| /blog/2024/ and /blog/2024/cat-stories/ | /guides/ | consolidated for thin pages |
| /archive/orphan/ | / | fallback only when nothing closer exists |
- Write the map as a file with two columns:
old,new(CSV is the format search-friendly hosts accept, but any two-column list works before it is imported).
Common map mistakes
- Pattern redirects instead of the full list: a blanket
/blog/*catches the new blog too, or relies on a mapping you did not list. Individual rows are the safe version. - Redirect loops: old -> new where new still sits on a rule that points back. Test with a 301 checker after the swap; the redirect loop article tells you what the browser says when this happens.
- Root fallback inflation: when too many old pages land on the home page, the home page becomes a soft-404 for those intents. Map each to its nearest real page instead.
- Missing trailing slashes:
/pathand/path/are different URLs under many servers. Be consistent; the map should normalize both to the same form your CMS emits.
Verifying a redirect map
- After import, run a head-request loop over the old URLs: each must return 301, with a Location header equal to the mapped target and no redirect loop.
- Confirm status is 301 and not 302, satisfying the redirect contract.
- Spot-check the targets resolve to 200 and to the content you expect (a 301 to a soft-404 is still a 404 for the user).
When the map is bigger than one file
A large site (hundreds of pages) needs the map imported into the server or CMS in chunks, and then re-checked in those same chunks, because a single bad row in a batch import usually kills the import. Keep the export sorted so missing rows are visible during review. The map becomes the single source of truth that a post-migration 404 sweep in the indexing analysis workflow verifies against.