How to move from WordPress to Next.js without losing rankings

Move from WordPress to Next.js: choose where content lives, keep URLs and trailing slashes, carry over SEO metadata, redirect the rest. Steps and config.

By Sohail Hussain19 November 20266 min read

To move from WordPress to Next.js without losing rankings, decide first where your content will live, then rebuild the templates in Next.js while keeping every URL identical where you can, including WordPress's trailing slash. Carry over each page's title, description and structured data, redirect the URLs that do change (archives, date-based posts, feeds), and watch Search Console closely for the first weeks. The front end changes completely; to Google, the site should look like the same pages, faster.

We build company sites with Next.js and move existing WordPress sites to it as part of our website redesign and migration service. Why we build company websites with Next.js explains the reasoning. This post is the practical side.

Should you move from WordPress to Next.js at all?

Good reasons: the site is slow despite tuning, security updates are a monthly worry, you need features WordPress makes awkward (a client portal, a calculator, an app-like interface), or a development team will maintain the site anyway.

Weak reasons: your marketing team builds new landing pages every week in a page builder, the site depends on plugins such as WooCommerce or an LMS that would each have to be rebuilt, or nobody will own the code after launch. In those cases a well-built WordPress site is the better answer. WordPress vs custom website walks through the decision.

Where will the content live after the move?

This is the first decision, because it shapes everything after it.

OptionEditors work inSuitsWatch out for
Headless WordPressThe WordPress admin they knowTeams that publish often and like WordPressYou still update and secure WordPress
Another headless CMS (Sanity, Payload, Contentful)A new, cleaner editorStructured content, several editorsContent export and a learning curve
Markdown or MDX files in the repositoryA code editor or GitSites edited by developersNon-technical editors cannot publish

Headless WordPress with Next.js covers the first option in depth, and how to add a CMS to a Next.js site the second.

How do you get the content out of WordPress?

Step 1: Inventory content and plugins

List every content type: pages, posts, custom post types, categories, tags, authors. Then list every active plugin and what it does for visitors. SEO plugins write titles and schema, form plugins handle enquiries, redirect plugins hold old redirects, and cookie, search and analytics plugins each add something to the page. Every front-end feature becomes a task in the new build. Export the redirect plugin's rules now; they belong in the new redirect map.

Step 2: Choose where content will live

Use the table above. If editors are happy in WordPress and publish weekly, keep it headless. If content is mostly static pages edited a few times a year, files or a lighter CMS remove a server you would otherwise maintain.

Step 3: Export the content

The WordPress REST API returns posts as JSON, up to 100 per request. The response headers X-WP-Total and X-WP-TotalPages tell you how many pages to fetch:

bash
curl -s "https://www.example.com/wp-json/wp/v2/posts?per_page=100&page=1&_embed" -o posts-1.json

Repeat for pages and for each custom post type that is exposed to the API. If you use Yoast SEO, each item includes a yoast_head_json field with its title, description, canonical and Open Graph data, which saves copying them by hand.

Step 4: Move the media

Image and PDF URLs under /wp-content/uploads/ collect links and image-search traffic too. The simplest way to keep them is to copy the uploads folder into the new site's public/wp-content/uploads/, so every file keeps its exact URL. For a large library, put the files in object storage and redirect /wp-content/uploads/ paths there instead.

How do you rebuild the site without changing its URLs?

Step 5: Rebuild templates and metadata

Build each template, then carry over metadata with generateMetadata in each route: title, description, canonical, Open Graph image, and the structured data the SEO plugin used to output. Check that every page has one H1 and the same heading as before, unless you are deliberately improving it.

Step 6: Keep URLs identical where possible

WordPress URLs end in a slash, such as /services/web-design/. Next.js removes trailing slashes by default with a permanent redirect, which would put a redirect in front of every page on your site. Set trailingSlash: true to keep the WordPress form, and use the same slugs. Most pages then need no redirect at all.

Step 7: Redirect what changes

These WordPress URLs are easy to forget:

  • Category, tag and author archives: /category/news/, /tag/seo/, /author/admin/.
  • Date-based post URLs, if permalinks ever included the date.
  • Feeds: /feed/ and /category/news/feed/.
  • Pagination: /page/2/, /category/news/page/3/.
  • Attachment pages and ?p=123 short links.

With trailingSlash: true, write redirect sources with the trailing slash, because that is the form the old URLs had:

ts
import type { NextConfig } from "next";

const nextConfig: NextConfig = {
  trailingSlash: true,
  async redirects() {
    return [
      {
        source: "/:year(\\d{4})/:month(\\d{2})/:slug/",
        destination: "/blog/:slug/",
        permanent: true,
      },
      {
        source: "/category/:slug/",
        destination: "/blog/category/:slug/",
        permanent: true,
      },
    ];
  },
};

export default nextConfig;

permanent: true sends a 308, which Google treats like a 301. As of October 2026, Vercel allows up to 1,024 redirects in this config, and the Next.js redirecting guide recommends Proxy (called Middleware before Next.js 16) for larger sets. Redirect mapping has the template for the full list, and the redirect generator writes the next.config.ts entries from it.

What breaks most often in a WordPress to Next.js move?

Four things catch teams out, usually in the last week before launch.

Shortcodes and page-builder markup. Content fetched through the REST API arrives as rendered HTML. Shortcodes from form, gallery or slider plugins come through as the markup the plugin generated, without the CSS and JavaScript it relied on. Search the exported content for them early and decide, one by one, whether each becomes a component or goes.

Forms. A form plugin handled validation, spam protection, email delivery and storage of submissions. In Next.js each of those is rebuilt, usually as a route handler or server action plus a transactional email service. Test delivery to the real inbox, not just the success message.

Site search. WordPress search at /?s= does not exist in the new site. Build a replacement or remove the search box. Nobody misses it on a ten-page site; everyone does on a blog with five hundred posts.

Hard-coded links inside content. Posts often contain absolute links to /wp-content/uploads/ files and old URL forms such as ?p=123. Keep the uploads paths working, as in step 4, and rewrite the other links during import, or each one becomes a redirect hop.

How do you launch the new site?

Step 8: Rebuild the sitemap and robots.txt

Next.js generates both from app/sitemap.ts and app/robots.ts. Compare the new sitemap's URL count with the old one; a large gap means pages were missed or archives dropped on purpose. Check the robots.txt with the robots.txt tester. Sitemaps and robots.txt in Next.js has the code.

Step 9: Launch and monitor

Switch the domain, then test redirects, submit the sitemap in Search Console and send a test enquiry through every form. Keep the old WordPress install running privately for a month so you can check anything that was missed. The week after a migration has the daily checklist, and the website redesign process puts this move in the context of the whole project.

Was this guide useful?

Questions

Frequently asked.

Will moving to Next.js improve my rankings?

Not on its own. Faster pages help visitors and your Core Web Vitals, but rankings follow content, links and relevance. Most of the gain from the move shows up in conversions, security and maintenance cost. If rankings rise afterwards, it is usually because the migration also fixed thin pages, slow templates or a muddled structure.

Can my team keep using the WordPress editor?

Yes, with headless WordPress. Editors keep the admin they know, and Next.js fetches content through the REST API or WPGraphQL. Previews of unpublished posts need extra work, using Next.js Draft Mode, so plan and test that early. Page-builder layouts do not carry over; they become fixed templates with editable fields.

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

For a company site of 20 to 50 pages with a blog, six to twelve weeks is typical as of October 2026, including design. Content volume, the number of plugins whose features must be rebuilt, and how many URLs change set the timeline. A straight rebuild with the same design and URLs is faster.

Sohail Hussain

Founder, MSH Technologies

Sohail has designed and built websites, web apps and AI products for over 12 years, for clients from Singapore-based industrial groups to early-stage SaaS startups. He writes about what actually worked.

Keep reading

Related guides.

All posts

Your next move

Like what you see? Tell us about it.

A process that takes too long, a website that undersells you, or an idea ready to take shape. Tell us where you are and we will suggest a useful next step.

India · Working with clients worldwide

Sohail, Founder, replies within 1 working day (Mon–Sat, IST). Free and no obligation.