redirect-map
Skill0 starsChanged 12 days agoMITView on GitHub
Build a 301 redirect map for a site migration, redesign, CMS or URL-structure change by matching old URLs to new URLs (exact, slug, fuzzy and parent-directory matching with confidence scores and review flags), then export ready-to-deploy rules for nginx, Apache, Netlify, Cloudflare Pages, Vercel or Cloudflare Bulk Redirects and check for chains and loops. Use when the user is migrating or relaunching a site, changing permalinks or domains, merging content, or asks for a redirect plan, redirect map or .htaccess/nginx redirects.
In this repository9 other files it gives its agents.
- AGENTS.mdAGENTS.md
- content-briefSkill
- core-web-vitals-triageSkill
- hreflang-checkSkill
- llms-txtSkill
- on-page-seo-reviewSkill
- robots-sitemap-checkSkill
- schema-markupSkill
- technical-seo-auditSkill
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 1 is distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 9
Make sure every old URL that has traffic, links or rankings lands on its best new equivalent with a single 301, and that nothing important …
- Very specific: line 45
Check before launch: no chains or loops, no redirects to 404s, internal links and canonicals updated to the new URLs, the new sitemap lists …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Redirect map
Make sure every old URL that has traffic, links or rankings lands on its best new equivalent with a single 301, and that nothing important is left to 404.
Paths below are relative to this skill's directory.
When to use
- Site migration, redesign, platform move (WordPress -> headless, Shopify, Webflow...), domain or HTTPS change
- Changing permalink structure, merging or pruning content
- "Write redirects for these URLs", "generate .htaccess / nginx redirects"
When not to use
- Checking an existing site's redirect chains from a crawl:
technical-seo-audit csv. - A single redirect: just write the rule.
Inputs to collect
- Old URL list - the union of: old sitemap(s), a crawl of the old site, Search Console/analytics top landing pages (last 12-16 months), and pages with backlinks. Missing sources are the main cause of lost traffic after a migration.
- New URL list - the new sitemap or a crawl of staging.
- The server or platform that will serve redirects (nginx, Apache, Netlify, Cloudflare Pages, Vercel, CMS plugin).
Workflow
- Generate the report:
python3 scripts/redirect_map.py old-urls.txt new-urls.csv > redirect-report.csvFiles can be plain lists or CSV exports (url/addresscolumn or the first column). The summary on stderr counts each method and the rows needing review. - Review in this order:
nonerows: decide per URL - map manually, restore the content, or let it 404/410 if it has no traffic, links or equivalent.parentrows (confidence 0.3): accept only when the parent truly covers the old page's topic; otherwise map to a specific page or 410.fuzzyrows withreview=yes, especially those with a "close alternative" note.- Rows noting "target is also an old URL": fix chains so every source points to the final URL. Sort by traffic/links first if the user has that data; the top 20% of URLs carry most of the value.
- Encode decisions by editing the CSV (or ask the user to), then export rules from a final two-column list, or export directly when the automatic matches are good enough:
python3 scripts/redirect_map.py old.txt new.csv --format nginx --min-confidence 0.7 -o redirects.confFormats:nginx(map block for$uri),apache(anchoredRedirectMatch 301),netlify(_redirects, also used by Cloudflare Pages),vercel({"redirects": [...]}to merge intovercel.json; path-to-regexp characters are escaped),cloudflare-bulk(headerless CSV to upload to a Bulk Redirects list; sources arehost/path, targets absolute; pass--host www.example.comwhen the URL lists are relative paths),csv,json. Add--absolute-targetsfor cross-domain moves. - Check before launch: no chains or loops, no redirects to 404s, internal links and canonicals updated to the new URLs, the new sitemap lists only new URLs. Use
--fail-on-unmatchedin CI to block a launch while rows still need review. - After launch: crawl the old URL list against production (
technical-seo-audit csvon the crawl export) and watch Search Console for 404 spikes for several weeks. Keep redirects in place for at least a year; permanently is better.
Decision points
- 301 vs 410. Redirect only to a genuinely equivalent or closely related page. Redirecting everything to the homepage is treated as a soft 404 and wastes the signals; use 410 for content that is gone for good.
- Query strings. nginx
$uriand ApacheRedirectMatchignore the query string; if old URLs differ only by parameters (?p=123), write those rules by hand on$args/RewriteCond %{QUERY_STRING}. - Case and trailing slashes. Normalise site-wide with one rule (or platform setting) instead of thousands of per-URL rules. Netlify normalises trailing slashes before matching rules and Cloudflare Pages manages trailing slashes itself, so the
netlifyandvercelformats skip slash-only rules (they would loop). - Large maps. nginx
maphandles tens of thousands of entries efficiently; ApacheRedirectMatchlists slow down beyond a few thousand - use aRewriteMapinstead. - Platform limits. Some hosts cap the number of redirect rules (Netlify, Vercel, Cloudflare Pages have documented limits); check before deploying very large maps.
Output
redirect-report.csvwith method, confidence, review flag and notes.- The deployable rules file for the user's server.
- A short summary: counts by method, rows still needing a decision, chains found, and the launch checklist above.
Files
scripts/redirect_map.py- matcher and exporter (--format,--threshold,--review-margin,--min-confidence,--absolute-targets,--fail-on-unmatched,-o).- references/migration-checklist.md - full pre- and post-launch migration checklist and server snippets.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

