Skip to content
Web Development

WordPress to Next.js Migration SEO: Keep Your Rankings

WordPress to Next.js migration SEO explained: how to keep your URLs, set up 301 redirects and carry over metadata so your Google rankings survive the move.

Keshur Gojiya

5 min read

WordPress to Next.js Migration SEO: Keep Your Rankings

Moving from WordPress to Next.js will not hurt your rankings if you keep the same URLs where you can, 301-redirect every URL that changes, carry over titles, meta descriptions, headings and structured data, and check the live site against a crawl of the old one. Most WordPress to Next.js migration SEO damage comes from skipped redirects and lost metadata, not from the framework itself. Here is the process I follow.

Will a WordPress to Next.js migration hurt my SEO?

It can, temporarily, if the migration is careless. Google has to re-crawl and re-process every page, so small ranking movements in the first weeks are normal even on a clean move. Lasting loss almost always has a specific cause: pages that now return 404, redirect chains, missing canonical tags, or content that was quietly rewritten or dropped.

The upside is real too. A Next.js site can be faster and cleaner in its HTML. But speed alone will not outweigh broken URLs, so protect the foundations first.

Step 1: Crawl and inventory the old site before touching anything

Before you build, export a complete list of what exists today. Without it you cannot prove nothing was lost.

  1. Crawl the live WordPress site with a crawler such as Screaming Frog, and save every URL with its status code, title, meta description, H1, canonical and indexability.
  2. Export your top landing pages and queries from Google Search Console, so you know which URLs earn traffic.
  3. Export the sitemap(s), including posts, pages, categories and any custom post types.
  4. Note which pages have backlinks. Those URLs matter most.

This spreadsheet becomes your redirect map and your post-launch checklist.

Step 2: Keep the same URLs wherever possible

The best redirect is the one you never need. If your WordPress permalinks look like /blog/my-post/, build the Next.js routes to produce exactly /blog/my-post/, with the same trailing-slash behaviour.

In Next.js this is controlled in next.config.js:

module.exports = {
trailingSlash: true,
};

Match whatever the old site used. If WordPress used /2021/05/my-post/ style dates, you can either recreate that route or redirect it. Keeping the URL is safer, but changing to a cleaner structure is fine if every old URL is redirected.

Step 3: Set up 301 redirects for every URL that changes

Every old URL that no longer exists at the same address needs a permanent redirect to its closest equivalent, not to the homepage. Redirecting everything to the homepage is treated by search engines much like a soft 404.

Next.js supports this in config. Setting permanent: true sends a 308, which search engines treat as permanent, like a 301.

module.exports = {
async redirects() {
return [
{
source: '/:year(\\d{4})/:month(\\d{2})/:slug',
destination: '/blog/:slug',
permanent: true,
},
{
source: '/category/news',
destination: '/blog',
permanent: true,
},
];
},
};

Practical points:

  • Redirect straight to the final URL. Avoid chains like old → intermediate → new.
  • Handle WordPress leftovers such as /feed/, /?p=123 shortlinks, /wp-content/uploads/ images that are linked from elsewhere, and author or tag archives that had traffic.
  • A very long redirect list may hit limits on your hosting platform's config-based redirects. Check your host's documentation, and use another mechanism if needed.

Step 4: Carry over titles, meta descriptions and structured data

On WordPress these usually live in an SEO plugin such as Yoast or Rank Math. They do not move on their own. Export them and store them as fields in the new CMS, for example seoTitle and seoDescription on each document in Sanity.

In the App Router, render them per page with generateMetadata, including the canonical URL:

export async function generateMetadata({ params }) {
const post = await getPost(params.slug);
return {
title: post.seoTitle || post.title,
description: post.seoDescription,
alternates: { canonical: `/blog/${post.slug}` },
};
}

Also recreate things the plugin was doing silently: Open Graph tags, an XML sitemap, robots.txt, breadcrumb or article structured data, and noindex on pages that had it. Compare against your crawl export.

Step 5: Model content so nothing is lost

The most common content mistake is dumping each WordPress post into one big rich-text blob. Take a little time to model it properly in Sanity: separate fields for title, slug, excerpt, publish date, author, categories, featured image with alt text, body and SEO fields.

Convert the WordPress HTML into portable text carefully, and check internal links, image alt text, headings hierarchy and embeds on a sample of pages. Shortcodes and page-builder markup are the usual trouble spots. Keep the visible content the same, since rewriting pages during the move makes it impossible to tell what caused any ranking change.

Step 6: Test on staging, then launch carefully

Before switching DNS:

  • Block the staging site from indexing, and remove that block at launch. Forgetting this is a classic mistake.
  • Crawl staging and compare it against the old crawl: status codes, titles, H1s and canonicals.
  • Test every redirect in your map and confirm each returns a single permanent redirect to a 200 page.
  • Check that images, forms and tracking scripts work.

Launch at a quiet time, keep the old site's content backed up, and submit the new sitemap in Search Console. If you want help running this end to end, my WordPress to Next.js and Sanity migration service covers these steps.

What should I check after launch?

In the first days, re-crawl the live site and look for 404s and redirect chains. In Search Console, watch the page indexing report and crawl errors, and track impressions for your top landing pages against the pre-launch export. Fix missing redirects immediately, since each day a ranking URL returns a 404 costs you visibility.

FAQ

How long does it take to recover rankings after migrating WordPress to Next.js?

It varies by site size and how clean the migration was. A well-executed move often settles within weeks, while a site with broken redirects can take much longer. I cannot give a guaranteed number, because it depends on the site.

Do I need to keep the same URLs when moving to Next.js?

No, but it is the safest option. If you change URLs, every old one needs a one-to-one 301 redirect to its closest equivalent page.

Will Next.js improve my SEO by itself?

Not by itself. Better performance and clean server-rendered HTML help, but rankings still depend on content quality, links and a correct technical setup. The migration protects what you have, and the performance gains are a bonus.

What happens to my WordPress SEO plugin data?

It stays in your database but does not appear on the new site automatically. Export titles, descriptions and canonicals, and store them as fields in your new CMS so they can be rendered on each page.

Key takeaways

  • Crawl and export the old site first, because that data is your redirect map and your launch checklist.
  • Keep URLs identical where possible, and 301-redirect every URL that changes to its closest match.
  • Migrate titles, meta descriptions, canonicals and structured data deliberately; the SEO plugin will not do it for you.
  • Do not rewrite content during the move, and monitor Search Console closely after launch.

Tags

  • WordPress Migration
  • Next.js
  • SEO
  • Sanity CMS

About Keshur Gojiya

Web developer and HTML email specialist with 6+ years of experience, building websites and emails for businesses, startups and agencies.

Get to know me
Keep Reading
View All Articles
  • Web Development

    7 min read

    WordPress to Next.js Migration Checklist: 6 Stages in Order

    A WordPress to Next.js migration checklist in six stages: audit, build, redirects, staging QA, launch day and the first weeks, so nothing gets lost.

    • WordPress Migration
    • Next.js
    Keshur Gojiya
  • Web Development

    6 min read

    How to Hire a Next.js Developer: What to Check and Ask

    How to hire a Next.js developer: what to check in their work, questions to ask before you sign, red flags, freelancer vs agency, and how to write a clear brief.

    • Next.js
    • Best Practices
    Keshur Gojiya
  • Web Development

    7 min read

    Is a Headless CMS Good for SEO? What to Set Up

    Is a headless CMS good for SEO? Yes, if the site is built right. The checklist: rendering, SEO fields, URLs, sitemaps, redirects, images and page speed.

    • SEO
    • Sanity CMS
    Keshur Gojiya

Need help with an email or website?

If an email is breaking in Outlook or dark mode, or you have a design that needs building, tell me about it and I’ll reply with next steps.

Email me