Migrating WordPress to headless without breaking SEO is possible, but requires an exhaustive URL inventory before switching over. I've seen two sites lose 40% of their organic traffic within three weeks after a migration done without mapping the existing URLs. The Next.js code was flawless, the deployment too. No one had listed the 320 required redirects. Here's the checklist I use on every migration project.
Before any Next.js code, I list all URLs indexed by Google. Not just articles: archive pages, tags, categories, attachments, RSS feeds, author pages.
Sources to cross-reference:
/sitemap.xml or /sitemap_index.xml (Yoast/Rank Math).Produce a single CSV file with: current URL, HTTP status, Search Console impressions over 12 months, average position, current title.
On an SMB site with 80 pages visible in the admin, the real inventory brings back on average 280 to 450 indexed URLs. That's the gap that kills sloppy migrations.
For each inventoried URL, decide:
| What can break | How to avoid it |
|---|---|
/category/xxx/ URLs not redirected | List all Yoast/Rank Math archives and decide on a target scheme |
?p=123 URLs (ID permalinks) | Verify no external link still points to them; 301 to slug |
/?attachment_id= attachments | Systematic 410 except special cases (PDFs, downloadable media) |
/feed/ RSS feeds | Keep on new site, same URL, same format |
/page/2/ pagination | Reproduce the same logic on the Next.js front |
| URLs with unencoded accents | Test UTF-8 encoding in redirects, otherwise 404 |
| URLs with inconsistent trailing slash | Pick a convention (with or without) and enforce it on the Next.js side |
Redirects are managed in next.config.js (up to about 1,000 entries) or in edge middleware beyond that. For a site with 300+ URLs, I prefer a dedicated JSON file imported by the middleware.
The sitemap is the contract with Google. Three common pitfalls:
sitemap.ts file convention that automates this since version 13.3.robots.txt with Sitemap: https://domain.tld/sitemap.xml.On the robots.txt side, explicitly allow new AI bots (GPTBot, PerplexityBot, ClaudeBot) or block them — but do it consciously. Blocking GPTBot removes your site from ChatGPT Search results.
This step is often neglected by front-end developers. On classic WordPress, SEO plugins (Yoast, Rank Math) automatically inject JSON-LD for Article, Organization, BreadcrumbList, FAQPage.
On Next.js, nothing is automatic. You have to:
generateMetadata or inline component).FAQPage and HowTo — these are the types most cited by AI search in 2026.On the sites I've migrated, rich result loss during the first 3 weeks post-switch was systematic when JSON-LD hadn't been rebuilt from day one.
The inventory must include, for each kept URL:
On Next.js, generateMetadata must reproduce this data identically for kept URLs. Any variation, even minor (a missing " | My site" suffix), can lose 10 to 20% of impressions while Google re-indexes.
One week before the DNS switch, I run the new site on a subdomain like preview.domain.tld (protected by noindex and basic auth to prevent crawling).
The testing checklist:
Drop DNS TTL to 300 seconds 48h before the operation. On D-day:
Expected 404 error spike in the 24 to 48h post-switch, while Googlebot re-crawls. If redirects are well done, the spike subsides in 5 to 10 days. If organic traffic drops by more than 15% at D+14, there's a redirect or schema issue to investigate.
If your site has fewer than 30 indexed pages and organic traffic under 1,000 visits/month, the SEO migration effort can exceed the benefit. An optimized WordPress (cache, CDN, WebP images, well-configured SEO plugin) will achieve similar results at a fraction of the cost.
Another case where I advise against: a site whose Google positions are fragile (positions 8 to 15 on commercial queries). A poorly executed migration can drop these positions to 30th place, and recovery takes 3 to 6 months. If SEO is your only acquisition channel, secure first, migrate later.
Migrating WordPress to headless without breaking SEO rests on three pillars: exhaustive URL inventory, gap-free 301 mapping, JSON-LD rebuilt from day one. The Next.js code is the easy part. For an overview of the architecture, see the Headless WordPress page.