# Migrating from WordPress to Next.js: A Complete Guide (Without Losing Your SEO)

> A practical WordPress to Next.js migration guide: when to leave WordPress (and when not to), the three migration paths, redirects, and keeping your SEO.

Author: [Pavle Aleksic](https://pavlealeksic.com/about)
Published: 2026-11-03
Source: https://pavlealeksic.com/blog/wordpress-to-nextjs-migration

A WordPress to Next.js migration is one of those projects that looks like a weekend job from the outside and turns out to be a content, SEO, and operations project wearing a frontend costume. The rebuild is the easy part. The hard parts are the 400 URLs you forgot existed, the contact form plugin that quietly fed your CRM, and the three weeks after launch when you stare at Search Console wondering whether that dip is normal.

This guide is for two readers: business owners deciding whether to leave WordPress at all, and developers who have been handed the migration and want a plan that doesn't torch years of organic traffic. The short version: migrate when WordPress is actively costing you (performance, security maintenance, developer velocity, or a product that has outgrown a CMS), pick one of three paths (headless WordPress, full migration to MDX, or a headless CMS), and treat URL mapping and redirects as the single most important deliverable. Do that and you can migrate WordPress to Next.js with little or no lasting SEO loss.

I have built and maintained WordPress and WooCommerce sites for most of my 18 years in this work, and the site you are reading this on was a WordPress site that I rebuilt on Next.js. So I have no religion here. WordPress is often the right answer. Let me tell you when it isn't.

## The short answer

- **Don't migrate** if your site is mostly marketing pages and a blog, it is reasonably fast, non-developers edit it every week, and nobody on the team writes React. Fix the hosting and the theme instead.
- **Migrate to headless WordPress** if editors love the WordPress admin but the frontend is slow, fragile, or impossible to extend.
- **Migrate fully to MDX/Markdown** if developers write most of the content, or the content set is small and stable. This is what I did for this site.
- **Migrate to a headless CMS** (Sanity, Contentful, Payload, Storyblok, and similar) if you have a real editorial team and want structured content without running WordPress.
- **Whatever you pick**, map every URL that has traffic or backlinks to a new URL, ship permanent redirects on launch day, keep them for at least a year, and watch Search Console daily for the first month.
- **Rough cost**: a small brochure or blog site is a few weeks of work; a large content site or one with e-commerce is a multi-month project. Ranges and assumptions are further down.

## When to migrate from WordPress (and when not to)

"Should I leave WordPress?" gets asked as if it were a technology question. It is mostly a business question. WordPress is a mature CMS with a huge ecosystem, cheap hosting, and an admin UI that non-technical people already know. Throwing that away has a real cost, and the replacement has to pay it back.

### Good reasons to migrate

- **Performance you cannot fix in place.** If Core Web Vitals fail because of a page builder, twelve marketing plugins, and a theme nobody can safely edit, the rescue often costs as much as the rebuild. A Next.js frontend with static or cached pages makes passing [Core Web Vitals](/blog/core-web-vitals-2026) the default instead of a fight.
- **Security and maintenance fatigue.** Every plugin is third-party PHP running with full access to your database. Keeping 30 of them patched is a recurring job, and the one abandoned plugin is usually how sites get compromised.
- **Your site has become an application.** Logged-in dashboards, custom pricing calculators, account areas, integrations with your SaaS product. Bending WordPress into an app framework works until it really doesn't.
- **Developer velocity and one codebase.** If your team works in TypeScript and React all day, marketing pages in PHP templates slow everything down. One stack lets product and marketing share components and auth.

### Bad reasons to migrate

- "Next.js is faster." It can be. A well-hosted WordPress site with page caching and a lean theme is also fast. Speed comes from architecture and discipline, not the framework name.
- "WordPress is bad for SEO." It isn't. WordPress with a decent SEO plugin produces clean, crawlable HTML. You don't gain rankings by switching frameworks. You only gain them by fixing whatever was actually wrong.

### The honest test

Ask who edits content and how often. If marketing publishes three posts a week and changes landing pages daily, the editing experience matters more than the rendering stack. That pushes you toward headless WordPress or a headless CMS, not Markdown files in Git. If a developer edits the site twice a month, a Git-based MDX setup is cheaper and faster than any CMS.

## The three WordPress to Next.js migration paths

There are really only three options. Everything else is a variation.

| | Headless WordPress | Full migration to MDX/Markdown | Migration to a headless CMS |
| --- | --- | --- | --- |
| Where content lives | WordPress database | Files in your Git repo | Vendor or self-hosted CMS |
| Who edits | Editors, in the familiar WP admin | Developers (or technical writers) | Editors, in a new UI |
| Data access | WPGraphQL or the WP REST API | File system at build time | Vendor API or SDK |
| You still run WordPress | Yes, as a backend | No | No |
| Plugin ecosystem | Partly usable (data plugins yes, frontend plugins no) | None | None, but integrations exist |
| Preview and drafts | Needs work to wire up | Git branches and preview deploys | Usually built in |
| Ongoing cost | WP hosting plus frontend hosting | Frontend hosting only | Frontend hosting plus CMS plan |
| Migration effort | Lowest for content, medium for frontend | Medium: export, convert, clean up | Highest: content modeling plus import |
| Best for | Big editorial teams who like WP | Developer blogs, docs, small marketing sites | Structured content, multiple channels, real editorial workflow |

### Path 1: headless WordPress with Next.js

You keep WordPress as the content backend and build the public site in Next.js. Editors notice almost nothing. The frontend team gets React, TypeScript, and full control over performance.

For data access you have two choices. The [WP REST API](https://developer.wordpress.org/rest-api/) ships with core and works out of the box. [WPGraphQL](https://www.wpgraphql.com/) is a plugin that exposes WordPress data through a GraphQL schema, and in October 2024 WordPress.org [announced it is becoming a canonical plugin](https://wordpress.org/news/2024/10/wpgraphql/), which matters if you were worried about it being abandoned. I prefer WPGraphQL for headless builds because you fetch exactly the fields a page needs in one request, including ACF fields and SEO plugin data if you install the matching extensions.

One gotcha: with "Plain" permalinks, WPGraphQL lives at `/index.php?graphql`. Any other permalink structure gives you the clean `/graphql` endpoint.

```ts
// lib/wp.ts — fetch a post by slug from WPGraphQL
const WP_GRAPHQL_URL = process.env.WP_GRAPHQL_URL!; // e.g. https://cms.example.com/graphql

type WPPost = {
  title: string;
  slug: string;
  date: string;
  modified: string;
  content: string;
  excerpt: string;
  featuredImage: { node: { sourceUrl: string; altText: string } } | null;
};

export async function getPostBySlug(slug: string): Promise<WPPost | null> {
  const res = await fetch(WP_GRAPHQL_URL, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      query: `
        query PostBySlug($slug: ID!) {
          post(id: $slug, idType: SLUG) {
            title
            slug
            date
            modified
            content
            excerpt
            featuredImage { node { sourceUrl altText } }
          }
        }
      `,
      variables: { slug },
    }),
  });

  if (!res.ok) throw new Error(`WPGraphQL ${res.status}`);
  const json = await res.json();
  return json.data?.post ?? null;
}
```

The trade-off: you now run two systems. WordPress still needs hosting, updates, and security patches. You've shrunk the public attack surface (WordPress can sit on a private subdomain), but not the maintenance. And plugins that render HTML (sliders, page builders, form plugins) stop working, so you rebuild those features in React.

Caching is the other big decision. You don't want every page view hitting WordPress. Render pages statically or cache them, and revalidate on publish with a webhook from WordPress. The mechanics of `use cache`, tags, and on-demand revalidation are in [Next.js 16 caching, demystified](/blog/nextjs-16-caching-demystified).

### Path 2: full migration to MDX or Markdown

You export every post and page, convert the HTML to Markdown or MDX, commit the files to the repo, and delete WordPress. No database, no CMS, no PHP. The site builds from files and deploys as static pages or close to it.

This is the cheapest thing to run and the fastest thing to serve. It is also the least friendly for non-technical editors: publishing means a Git commit. For a developer's blog or docs site, that is a feature. For a newsroom, it is a non-starter.

This site took this path. The content is a set of `.mdx` files with frontmatter, rendered by Next.js, and the editing workflow is my code editor.

### Path 3: migration to a headless CMS

You move the content into a dedicated headless CMS and build the frontend in Next.js. Editors get a modern UI with structured content types, previews, scheduled publishing, and roles. You stop running WordPress entirely.

The real work here is **content modeling**. WordPress stores most content as one big HTML blob per post, often full of shortcodes and page-builder markup. A headless CMS wants structured fields and blocks. Converting the blob into clean structure is where the hours go, and it is worth doing properly because it decides how pleasant the next five years of editing will be.

Most hosted headless CMSes charge by seats, records, or API usage, so price out your real team size and content volume first. Self-hosted options trade the subscription for hosting and maintenance.

## Exporting your WordPress content

Whatever path you choose (except staying headless), you need the content out of WordPress in a form you can process. There are three ways, and I usually use two of them together.

### The WP REST API

Best for scripted exports where you want clean JSON with IDs, slugs, dates, and taxonomy references. The [pagination docs](https://developer.wordpress.org/rest-api/using-the-rest-api/pagination/) are the part to read: `per_page` is capped at 100, and the response tells you how many pages there are in the `X-WP-TotalPages` header.

```ts
// scripts/export-wp.ts — pull every published post as JSON
import { writeFile, mkdir } from 'node:fs/promises';

const SITE = 'https://old.example.com';

type WPRestPost = {
  id: number;
  slug: string;
  link: string;
  date_gmt: string;
  modified_gmt: string;
  title: { rendered: string };
  excerpt: { rendered: string };
  content: { rendered: string };
  categories: number[];
  tags: number[];
  featured_media: number;
};

async function fetchAll(type: 'posts' | 'pages'): Promise<WPRestPost[]> {
  const all: WPRestPost[] = [];
  let page = 1;
  let totalPages = 1;

  do {
    const url = `${SITE}/wp-json/wp/v2/${type}?per_page=100&page=${page}&status=publish`;
    const res = await fetch(url);
    if (!res.ok) throw new Error(`${url} -> ${res.status}`);
    totalPages = Number(res.headers.get('X-WP-TotalPages') ?? 1);
    all.push(...((await res.json()) as WPRestPost[]));
    page++;
  } while (page <= totalPages);

  return all;
}

const posts = await fetchAll('posts');
const pages = await fetchAll('pages');
await mkdir('export', { recursive: true });
await writeFile('export/posts.json', JSON.stringify(posts, null, 2));
await writeFile('export/pages.json', JSON.stringify(pages, null, 2));
console.log(`Exported ${posts.length} posts and ${pages.length} pages`);
```

The `link` field is the post's current public URL. It becomes the "from" side of your redirect map.

The catch: the REST API only exposes what the site and its plugins expose. Custom post types need `show_in_rest` enabled, and custom fields may not appear at all. On the plus side, `content.rendered` is the HTML after shortcodes ran, which is usually what you want.

### WP-CLI

If you have shell access to the server, [WP-CLI](https://developer.wordpress.org/cli/commands/export/) is faster and sees everything. `wp export` writes WXR files containing authors, terms, posts, comments, and attachment records. It does not include the media files themselves or site options.

```bash
# Full WXR export of posts and pages, one file per 50MB
wp export --dir=./export --post_type=post,page --max_file_size=50

# Quick inventory of every published URL (gold for the redirect map)
wp post list --post_type=post,page --post_status=publish \
  --fields=ID,post_name,url --format=csv > export/urls.csv

# Grab the uploads directory for media
rsync -avz user@server:/var/www/html/wp-content/uploads/ ./export/uploads/
```

You can also query custom fields directly with `wp post meta list` when you need ACF data the REST API doesn't show.

### WXR (Tools → Export)

The WXR file is what Tools → Export gives you: WordPress's XML export format. It is the right input if your target headless CMS has a WordPress importer, or if you have no shell or API access. Post content is raw (shortcodes unexpanded), so expect cleanup.

### Converting HTML to Markdown

For the MDX path, convert `content.rendered` to Markdown with a library like Turndown, then clean up by hand. Budget real time for the cleanup. The automated pass gets you 80 to 90 percent there, and the last 10 percent is page-builder divs, inline styles, embedded iframes, and the odd shortcode that rendered as nothing. In MDX specifically, any stray `<` or curly brace in prose will break the build, so escape or rewrite those.

## URL mapping and 301 redirects

If you only do one thing in this guide properly, do this. Lost rankings after a migration are almost always lost URLs: pages that existed, had links and traffic, and now return 404.

### Build the URL inventory

Pull URLs from every source, because each catches things the others miss:

1. The WordPress export (`link` fields or the WP-CLI CSV).
2. The current XML sitemap (often generated by Yoast or Rank Math).
3. Search Console's Pages report and the Performance report (URLs that actually get impressions).
4. Your analytics: every landing page with traffic in the last 12 months.
5. A crawl of the live site with a crawler like Screaming Frog.
6. Your backlink tool, if you have one: URLs other sites link to.

Then add the URLs WordPress generates that nobody thinks of: `/category/...`, `/tag/...`, `/author/...`, `/page/2/`, `/feed/`, date archives like `/2021/04/`, attachment pages, and `?p=123` shortlinks. Decide for each group whether it maps to a new page, to a parent (category archive to the new blog index), or genuinely goes away.

Put it all in a spreadsheet: old URL, new URL, status (keep, redirect, gone). Every row with traffic or backlinks needs a destination, and it should be the closest equivalent page, not the homepage.

### Keep URLs where you can

The cheapest redirect is the one you don't need. If you can keep a post's slug and path, keep it. Watch trailing slashes: WordPress uses them by default, Next.js doesn't. Either set `trailingSlash: true` to keep the old shape, or let Next.js redirect them and make canonicals and the sitemap use the new form consistently.

### Redirects in next.config

The [`redirects` config](https://nextjs.org/docs/app/api-reference/config/next-config-js/redirects) is the first tool. `permanent: true` returns a 308 rather than a 301. That's fine: Google's [site move guidance](https://developers.google.com/search/docs/crawling-indexing/site-move-with-url-changes) recommends permanent redirects "such as 301 and 308," and Next.js uses 308 so the request method is preserved.

```ts
// next.config.ts
import type { NextConfig } from 'next';
import redirectMap from './redirects.json'; // [{ "from": "/old", "to": "/new" }, ...]

const nextConfig: NextConfig = {
  async redirects() {
    return [
      // WordPress date-based permalinks -> /blog/slug
      {
        source: '/:year(\\d{4})/:month(\\d{2})/:slug',
        destination: '/blog/:slug',
        permanent: true,
      },
      // Category and tag archives
      { source: '/category/:cat', destination: '/blog/category/:cat', permanent: true },
      { source: '/tag/:tag', destination: '/blog', permanent: true },
      // Paginated archives
      { source: '/page/:n(\\d+)', destination: '/blog', permanent: true },
      // RSS feed moved
      { source: '/feed', destination: '/rss.xml', permanent: true },
      // One-off mappings from the spreadsheet
      ...redirectMap.map(({ from, to }) => ({
        source: from,
        destination: to,
        permanent: true,
      })),
    ];
  },
};

export default nextConfig;
```

Use patterns for anything with a rule and the spreadsheet for everything else. Avoid redirect chains (Google suggests no more than three hops; I aim for one), and generate `redirects.json` from the spreadsheet with a script, never by hand.

### Thousands of redirects: use proxy

If you have thousands of one-off redirects, a giant config array is slow to evaluate and some hosts limit how many you can define. In Next.js 16, `middleware` is now called [proxy](https://nextjs.org/docs/app/api-reference/file-conventions/proxy), and it is the right place for a lookup table:

```ts
// proxy.ts
import { NextResponse, type NextRequest } from 'next/server';
import redirects from './redirects-map.json'; // { "/old-path": "/new-path", ... }

const map = redirects as Record<string, string>;

export function proxy(request: NextRequest) {
  const path = request.nextUrl.pathname.replace(/\/$/, '') || '/';
  const target = map[path];
  if (target) {
    return NextResponse.redirect(new URL(target, request.url), 308);
  }
}

export const config = {
  matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'],
};
```

Redirects at the CDN layer (Cloudflare Bulk Redirects, Netlify `_redirects`, and similar) are often best for very large maps, because the request never touches your app.

### Keep them for a long time

Google's guidance is to keep redirects "for as long as possible, generally at least 1 year." I keep them forever. They cost nothing, and somebody's 2019 forum post linking to your old URL will still send traffic in 2030.

## Preserving SEO on the new Next.js site

Redirects protect the URLs. The rest of WordPress-to-Next.js SEO is making sure every page on the new site sends signals at least as good as the old one did. Your Yoast or Rank Math plugin was quietly doing a lot of this. Now you do it in code.

### Titles, descriptions, and canonical tags

Export the SEO title and meta description for every post (from post meta via WP-CLI, or the SEO plugin's API extension). Don't let them silently fall back to the post title. Hand-tuned titles are often what earned the clicks.

```tsx
// app/blog/[slug]/page.tsx
import type { Metadata } from 'next';
import { getPost } from '@/lib/posts';

export async function generateMetadata({
  params,
}: {
  params: Promise<{ slug: string }>;
}): Promise<Metadata> {
  const { slug } = await params;
  const post = await getPost(slug);
  if (!post) return {};

  const url = `https://example.com/blog/${post.slug}`;
  return {
    title: post.seoTitle ?? post.title,
    description: post.description,
    alternates: { canonical: url },
    openGraph: {
      type: 'article',
      url,
      title: post.seoTitle ?? post.title,
      description: post.description,
      publishedTime: post.date,
      modifiedTime: post.updated ?? post.date,
      images: post.image ? [{ url: post.image }] : undefined,
    },
  };
}
```

Every page gets a self-referencing canonical with the absolute, final URL (correct protocol, host, and trailing slash convention). Canonicals pointing at the old domain or at the staging site are a classic launch-day bug.

### Sitemap and robots.txt

Generate the sitemap from the same source as your pages so it can't drift. Next.js has a [`sitemap.ts` file convention](https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap) for exactly this, and `generateSitemaps` if you exceed the 50,000-URL-per-file limit.

```ts
// app/sitemap.ts
import type { MetadataRoute } from 'next';
import { getAllPosts } from '@/lib/posts';

export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
  const posts = await getAllPosts();
  return [
    { url: 'https://example.com', lastModified: new Date() },
    { url: 'https://example.com/blog', lastModified: new Date() },
    ...posts.map((p) => ({
      url: `https://example.com/blog/${p.slug}`,
      lastModified: p.updated ?? p.date,
    })),
  ];
}
```

The sitemap should list only final, canonical, 200-status URLs. No redirects, no noindexed pages. Check `robots.txt` too: staging sites usually block everything, and copying that file to production is how sites vanish from Google.

### Structured data

If your old site emitted `Article`, `BreadcrumbList`, `Organization`, `Product`, or `FAQPage` schema through a plugin, reproduce it as JSON-LD in your page components. Run a few key templates through Google's Rich Results Test before launch and compare against the old pages. Structured data also helps AI answer engines understand your pages, which I cover in [SEO for AI search crawlers](/blog/seo-for-ai-search-crawlers).

### Content parity

Keep the content the same at launch: same headings, body, internal links (updated to new URLs), and alt text. If you also rewrite everything, you can't tell whether a traffic change came from the migration or the rewrite.

### Performance as an SEO lever

This is where the migration should pay off: static or cached HTML, optimized images, minimal client JavaScript. [Web caching explained](/blog/web-caching-explained) covers where each cache layer sits. Verify with real-user data after launch, not a Lighthouse run on your laptop.

### Search Console: monitoring the change

Before launch, verify the new site in Search Console if anything about the domain or protocol changes, and export a baseline: top pages, top queries, clicks, and impressions for the last three months.

After launch:

1. Submit the new sitemap. Google's guidance says you can then remove the old one, and warnings that old sitemap URLs redirect are expected.
2. Watch the Pages (indexing) report daily for a spike in "Not found (404)" or "Page with redirect" you didn't plan for.
3. Use URL Inspection on your 20 most important pages to confirm Google sees the new canonical.
4. Compare clicks and impressions against the baseline, page by page, for the top 50 URLs.
5. If you changed domains, use the Change of Address tool. It is only for domain or subdomain moves, not path changes on the same domain.

Expect some fluctuation. Google's own documentation says rankings may move while it recrawls, and that a medium-sized site can take a few weeks or more for the new URLs to settle. A dip that recovers over a few weeks is normal. A cliff that keeps falling means something is broken, usually redirects, canonicals, or `robots.txt`.

## Images and media

WordPress media lives in `/wp-content/uploads/YYYY/MM/`, with multiple resized copies of each image. You have three options:

- **Move them into the repo** under `public/` (fine for a few hundred images, painful past that).
- **Move them to object storage** (S3, Cloudflare R2, or similar) behind a CDN, and rewrite the URLs in your content during conversion.
- **Use an image service** (Cloudinary, imgix, or your CMS's asset pipeline) that handles resizing and formats for you.

Whichever you choose, rewrite image URLs at export time, and redirect `/wp-content/uploads/:path*` to the new location so hotlinks and Google Images keep working.

Use `next/image` (or your CDN's equivalent) for responsive sizes and modern formats, set dimensions on every image, and keep the original alt text.

## Forms, comments, and search

These are the three features WordPress gave you for free through plugins and that you now have to replace deliberately.

**Forms.** Contact Form 7, Gravity Forms, and WPForms all disappear. In Next.js, a form is a Server Action that validates input, saves or emails it, and returns a result. The patterns are in my post on [Server Actions for forms and mutations](/blog/nextjs-server-actions-forms-mutations). Add spam protection (Cloudflare Turnstile, hCaptcha, or a honeypot plus rate limiting), and before you delete the old plugin, find out where its submissions went. In sites I have taken over, there's often a hidden integration: a CRM webhook, a Mailchimp list, a Zapier hook. That must be rebuilt, not forgotten.

**Comments.** Ask whether you need them. Many business blogs have comment sections full of spam and nothing else. If you do, use a hosted service (Giscus for developer audiences, Disqus, or similar), keep WordPress comments in a headless setup, or build your own. Export existing comments that have value; they are part of the page's content.

**Search.** WordPress search was a SQL `LIKE` query, so the bar is low. For a static or MDX site, a client-side index (Pagefind or a small Fuse.js index) is free and fast. For larger sites, Algolia, Meilisearch, Typesense, or Postgres full-text search.

## Plugins to code: what replaces what

Inventory every active plugin, write down what it actually does on the live site, then rebuild it, replace it with a service, or drop it.

| WordPress plugin category | Next.js equivalent |
| --- | --- |
| SEO (Yoast, Rank Math) | `generateMetadata`, `sitemap.ts`, `robots.ts`, JSON-LD components |
| Redirection plugin | `redirects` in `next.config`, proxy, or CDN redirect rules (export its rules first) |
| Caching (WP Rocket, W3 Total Cache) | Static rendering, `use cache`, CDN caching; mostly unnecessary |
| Image optimization (Smush, ShortPixel) | `next/image` or an image CDN |
| Forms (CF7, Gravity Forms) | Server Actions plus an email/CRM integration |
| Security and firewall (Wordfence) | Mostly gone with WordPress; use a WAF and rate limiting at the edge |
| Analytics and tag managers | A script component, loaded lazily |
| Page builders (Elementor, Divi) | Your React component library |
| ACF / custom fields | Frontmatter, CMS fields, or typed content models |
| Multilingual (WPML, Polylang) | Locale-based routing and an i18n library; plan hreflang carefully |
| Membership and gated content | Your own auth and authorization; non-trivial, scope it separately |
| WooCommerce | A separate decision entirely (see below) |

The Redirection plugin deserves a special mention. If the old site used it, it already contains years of redirects. Export those rules and fold them into your new redirect map, or you'll break URLs that were already redirected once.

WooCommerce is the big one. Moving a store is a commerce re-platforming, not a CMS migration: products, variants, customers, orders, payment gateways, tax, shipping, and subscriptions. You can run WooCommerce headless behind a Next.js storefront, or move to Shopify or another commerce backend. I cover the trade-offs in [headless commerce in 2026](/blog/headless-commerce-2026), and if the real problem is speed, [making WooCommerce fast](/blog/woocommerce-speed-optimization) may be the cheaper fix.

## Hosting choices for the new site

Next.js runs in a lot of places, and the choice affects cost and what features you can use.

| Option | Good for | Watch out for |
| --- | --- | --- |
| Vercel | Least setup, every Next.js feature works first | Usage-based pricing on high-traffic sites; read the pricing page against your traffic |
| Cloudflare Workers (via the OpenNext adapter) | Global edge, generous pricing, cheap bandwidth | Adapter layer; test features like ISR and image optimization |
| Netlify | Similar developer experience to Vercel | Check Next.js feature support for your version |
| Self-hosted Node or Docker | Full control, predictable cost on your own infra | You own caching, scaling, and image optimization |
| Static export | Pure MDX sites with no server features | No proxy, no Server Actions, no on-demand revalidation |

If you go headless WordPress, you are paying for WordPress hosting too, but it can be a small, private instance since it no longer serves public traffic.

## Step-by-step migration plan

This is the order I run a migration in. Skipping steps 1 to 3 is how migrations lose traffic.

1. **Audit and baseline.** Inventory URLs, plugins, forms, integrations, and content types. Export Search Console, analytics, and Core Web Vitals baselines.
2. **Decide the path.** Headless WordPress, MDX, or headless CMS, based on who edits and how often.
3. **Build the URL map.** Every old URL with traffic or backlinks gets a destination. Get sign-off on it.
4. **Model the content.** Define frontmatter or CMS schemas: title, SEO title, description, date, updated date, author, categories, featured image, body.
5. **Export and convert.** Script the export, convert HTML, migrate media, and rewrite internal links and image URLs to their new forms.
6. **Build the frontend.** Templates, components, metadata, sitemap, structured data, and replacements for forms, search, and comments.
7. **Rebuild integrations.** CRM hooks, email lists, analytics, tag manager, consent banner.
8. **Staging review.** Crawl staging and diff it against the old crawl: titles, descriptions, H1s, canonicals, status codes. Keep staging `noindex`, and make sure that doesn't ship.
9. **Redirect test.** Script a check that requests every old URL against staging and asserts a single permanent redirect to the expected destination with a 200 at the end.
10. **Content freeze.** Stop publishing on the old site for the final export, or plan a delta export.
11. **Launch.** Follow the checklist below.
12. **Monitor for four to eight weeks.** Daily for the first two weeks, then weekly. Fix 404s as they show up.
13. **Then improve.** Only after rankings settle, start rewriting content, restructuring sections, and chasing new keywords.

Step 9 is cheap and catches most of the disasters:

```ts
// scripts/check-redirects.ts
import map from '../redirects.json';

const BASE = process.env.BASE_URL ?? 'https://staging.example.com';
let failures = 0;

for (const { from, to } of map as { from: string; to: string }[]) {
  const res = await fetch(BASE + from, { redirect: 'manual' });
  const location = res.headers.get('location') ?? '';
  const ok = [301, 308].includes(res.status) && new URL(location, BASE).pathname === to;
  if (!ok) {
    failures++;
    console.error(`FAIL ${from} -> ${res.status} ${location} (expected ${to})`);
  }
}

console.log(failures ? `${failures} failures` : 'All redirects OK');
process.exit(failures ? 1 : 0);
```

## Launch-day checklist

- [ ] DNS TTL lowered a day or two before launch so you can roll back quickly
- [ ] Final content export done after the freeze, with no posts missing
- [ ] `robots.txt` allows crawling; no stray `noindex` meta tags or headers in production
- [ ] Every page has a self-referencing canonical with the production URL
- [ ] Redirect test script passes against production
- [ ] `/wp-admin`, `/wp-login.php`, and `/xmlrpc.php` return 404 or redirect (unless you're headless and WP lives elsewhere)
- [ ] Sitemap is live, contains only 200 URLs, and is submitted in Search Console
- [ ] Analytics and conversion tracking firing on the new site
- [ ] Every form submits and reaches its real destination (inbox, CRM, list)
- [ ] RSS feed works at the old URL or redirects to the new one
- [ ] Old media URLs redirect or still resolve
- [ ] HTTPS everywhere, with www/non-www and trailing-slash redirects consistent
- [ ] Old WordPress backed up and kept read-only for a few weeks
- [ ] Someone is watching Search Console and server logs for the next two weeks

## Cost and timeline estimates

These are estimates for planning, not quotes. They assume an experienced developer or small team, a site in reasonable shape, and that someone on your side can answer questions and review staging quickly. Rates vary widely by region and seniority, so I express them as effort.

| Site type | Typical scope | Estimated effort | Estimated calendar time |
| --- | --- | --- | --- |
| Small brochure site or blog | Under ~50 pages, simple templates, one form | 1 to 3 weeks | 2 to 5 weeks |
| Content-heavy marketing site | Hundreds of posts, several templates, CMS, search, integrations | 4 to 10 weeks | 2 to 4 months |
| Large publisher or multilingual site | Thousands of URLs, custom post types, multiple languages, editorial workflow | 3 to 6+ months | 4 to 9 months |
| WooCommerce store | Products, customers, orders, payments, shipping, tax | Treat as a re-platforming project and scope separately | Often 3 to 6+ months |

What moves the number up:

- **Page builders.** Elementor or Divi content converts badly and often needs manual rework page by page.
- **Custom post types and ACF.** Each one is a content model to design and a converter to write.
- **Multilingual.** Every URL multiplied by every language, plus hreflang.
- **Integrations.** Each CRM, membership, or e-commerce hook is its own small project.
- **Design changes.** Migrating and redesigning at the same time is two projects, priced as two projects.

What moves it down: a simple theme, content in the block editor, few plugins, and a decision-maker who answers within a day. Calendar time is usually dominated by review cycles, not code.

Ongoing cost changes too: an MDX site can run on a low-cost hosting tier, headless WordPress adds WordPress hosting, and a headless CMS adds a subscription that scales with seats and usage. Check current pricing pages, since they change often.

## Frequently asked questions

### Will I lose my SEO rankings if I migrate from WordPress to Next.js?

Not if you preserve URLs or redirect them properly, keep titles, descriptions and content the same at launch, and fix crawl issues quickly. Expect some fluctuation for a few weeks while Google recrawls, which Google's own site-move documentation acknowledges. Lasting losses almost always come from missing redirects, wrong canonicals, or a `robots.txt` copied from staging.

### What is headless WordPress with Next.js?

It means WordPress stays as the content backend where editors write, and a Next.js app renders the public website by fetching content through WPGraphQL or the WP REST API. Editors keep the familiar admin, and the frontend gets React's flexibility and performance. The cost is running and maintaining two systems.

### Should I use WPGraphQL or the WP REST API?

The REST API is built into WordPress and fine for simple sites or one-off exports. WPGraphQL lets you request exactly the fields you need in one query, which is cleaner for headless builds with custom fields and SEO data. WordPress.org has announced WPGraphQL is becoming a canonical plugin, so long-term support looks solid.

### How long does a WordPress to Next.js migration take?

A small brochure site or blog is usually a few weeks of work. A content-heavy site with integrations is typically two to four months of calendar time. Large multilingual sites and WooCommerce stores take longer and should be scoped individually. These are estimates; page builders, custom post types, and slow review cycles push them up.

### Should I use 301 or 308 redirects?

Either is fine for SEO. Google recommends permanent redirects and names both 301 and 308. Next.js returns 308 when you set `permanent: true` because it preserves the request method, and you can set a `statusCode` of 301 explicitly if you have a specific reason.

### Should I redesign the site during the migration?

I'd avoid it if you can. Changing the platform, URLs, design, and content at once makes it impossible to diagnose a traffic drop. Migrate with content parity first, let rankings settle for a few weeks, then iterate on design and content.

## Working with me

I have spent years on both sides of this, building and maintaining WordPress and WooCommerce sites and building Next.js frontends, so I can tell you honestly whether migrating is worth it for your site or whether fixing what you have is the better spend. If you're planning a WordPress to Next.js migration, take a look at my [frontend development services](/services/frontend), or [e-commerce work](/services/ecommerce) if a store is involved, and [get in touch](/contact) with your URL and what is bothering you about the current site.
