Agenxus

HubSpot CMS to Next.js Migration: How to Move and Keep Your Rankings

How to move a HubSpot CMS website to Next.js while keeping HubSpot CRM, forms and tracking, and without losing rankings: URL inventory, redirects and testing.

Agenxus Team••9 min•
#HubSpot#Next.js#Site Migration#301 Redirects#Technical SEO#B2B Websites

Most marketing teams that leave HubSpot Content Hub are not leaving HubSpot. They want a faster site and more control, but the CRM, lead routing and email workflows are working fine. The good news is that you can split the two. The risk sits almost entirely in the URLs and redirects, not in the CRM.

What a HubSpot CMS to Next.js migration is

You rebuild the public website (pages, blog, templates, metadata) as a Next.js app on new hosting and point your domain at it. HubSpot stays as the CRM. Forms keep submitting to HubSpot, the tracking code keeps recording visits, and workflows keep running. What changes is who serves the pages and who handles redirects.

What moves off HubSpot and what stays?

Draw this line before anyone writes code. It decides the scope, the budget and who has to sign off. Here is the split we use on HubSpot projects.

Typical split in a HubSpot CMS to Next.js move
ItemMoves to Next.jsStays in HubSpot
Website pages and templatesYes, rebuilt as componentsOld pages unpublished after cutover
Blog posts, tags, authorsYes, content exported and remappedNo
URL redirectsYes, rebuilt in Next.js or the hostStop working once the domain moves
Titles, meta descriptions, schemaYes, carried over per URLNo
Forms and submissionsRendered on the new siteForm definitions, submissions, notifications
Contacts, deals, workflows, emailNoYes, unchanged
Tracking and attributionTracking code installed in the new layoutReporting stays in HubSpot
Landing pages for campaignsOptional, case by caseCan stay on a HubSpot subdomain

Landing pages are the main judgment call. Some teams keep campaign pages on a HubSpot-hosted subdomain so marketers can still build them in the drag-and-drop editor. Others move everything so the whole site shares one design system and one performance budget.

Can you keep HubSpot CRM and forms on a Next.js site?

Yes. HubSpot supports forms on sites it does not host. There are three ways to connect them, and the choice affects page speed, design control and attribution.

Three ways to send Next.js form submissions to HubSpot
MethodHow it worksTrade-off
HubSpot embed codePaste the form's embed script into a client componentFastest to set up; loads HubSpot's script and styling
Forms API submissionYour own form posts to the v3 submit endpoint with portal ID and form GUIDFull design control; you build validation and pass the hutk cookie
Non-HubSpot forms toolHubSpot's tracking code captures plain HTML form submissionsLittle code, but depends on the tracking code and field mapping

With the embed route, HubSpot notes that the page's domain must be added as a site domain to be treated as trusted. It also says form analytics need the tracking code on the same page. Miss either step and forms may still submit, but reporting gets patchy.

With the API route, your form posts to the authenticated submit endpoint. Pass the hutk visitor cookie and the pageUri in the context object. Without them, the contact is created but loses the page-view history that sales teams rely on.

For tracking, HubSpot says externally hosted pages need the tracking code installed manually. In Next.js, load it once in the root layout with the Script component. Client-side route changes do not reload the page, so also send a page view through the _hsq queue (setPath, then trackPageView) on each navigation.

Why HubSpot redirects stop working the day you switch DNS

This is the step teams miss most often. HubSpot's documentation is direct: URL redirects only work for domains connected to and hosted in HubSpot. Once your domain points at the new host, every redirect in the HubSpot URL Redirects tab stops resolving.

Many HubSpot sites have more redirects than anyone remembers. HubSpot automatically creates a redirect whenever someone changes the URL of a published page or blog post. Years of slug edits can leave hundreds of rules that still carry backlinks and rankings.

Export before you cut over

Export the full list from Settings > Website > Domains & URLs > URL Redirects, or pull it through HubSpot's URL redirects API. Rebuild each rule on the new site, pointing straight at the final destination. If an old rule points to a URL that is also changing, update it so it does not create a chain.

Which HubSpot URL patterns need a mapping?

Your visible pages are only part of the inventory. HubSpot generates several URL types automatically, and each needs a decision: keep, redirect, or retire.

  • Blog posts: usually /blog/post-slug. Keep the same path in Next.js where possible, which means no redirect at all.
  • Tag listing pages: HubSpot creates /blog/tag/tag-name for each tag. Keep the ones with traffic, and redirect the thin ones to the closest topic hub.
  • Author pages: /blog/author/name. Rebuild them as real author pages if they rank or support expertise signals.
  • Paginated listings: /blog/page/2 and beyond. Match the pattern or redirect to the new listing.
  • Blog RSS feed: subscribers and some tools still request it. Keep a feed at the same path or redirect it.
  • File manager URLs: PDFs and images uploaded to HubSpot and linked from your pages. Download and rehost the ones that rank or earn links.
  • Landing and thank-you pages: decide which move and which stay on a HubSpot subdomain.
  • Old redirect sources: every source path in the exported redirect list.

Tag pages are where HubSpot sites differ most from WordPress sites. If you are coming from WordPress instead, our WordPress to Next.js migration checklist covers that platform's patterns.

The URL inventory and redirect testing we run

Google's site move guidance starts with the same thing: prepare a URL mapping from current URLs to new ones. Here is how we build and test that map on a HubSpot CMS to Next.js migration.

  1. 1

    Collect every URL

    Merge a full crawl, the XML sitemap, the HubSpot redirect export, Search Console Performance pages from the last 16 months and top pages from Semrush or Ahrefs. Deduplicate.

  2. 2

    Attach the data

    For each URL, record clicks, impressions, ranking keywords, backlinks, title, meta description and any structured data. This tells you which URLs carry real value.

  3. 3

    Map each URL

    Assign one outcome: same path, new path with a permanent redirect, or retire with a 410 or 404 if nothing relevant replaces it. Do not send old URLs to the homepage.

  4. 4

    Carry over the on-page signals

    Copy titles, metadata and schema into the new templates. Add a self-referencing canonical to each new URL, as Google recommends.

  5. 5

    Test on staging

    Run every old path against the staging site with a script. Each must return 200 or a single permanent redirect that lands on a 200. Flag chains, loops and redirects to 404s.

  6. 6

    Cut over and re-test

    Switch DNS, then run the same script against production within the hour. Submit the new sitemap in Search Console the same day.

One detail surprises people. The redirects option in next.config.js returns 308 for permanent redirects, not 301. That is fine for search. Google's redirect documentation lists both 301 and 308 as permanent server-side redirects. For very large redirect lists, the Next.js docs include a section on managing redirects at scale with middleware.

Avoid soft 404s

Google warns against redirecting many old URLs to one irrelevant page. A tag page redirected to the homepage often gets treated as a soft 404, so its signals are lost anyway. Redirect to the closest equivalent, or retire the URL honestly.

What to watch in Search Console after launch

The first weeks tell you whether the map held. We check Search Console daily for 60 days. These are the reports that matter most.

  • Page indexing report: watch "Not found (404)", "Soft 404" and "Page with redirect". A spike in 404s usually means a missed URL pattern.
  • Performance report: compare clicks and impressions by page against the month before launch. Filter for old URLs that still show impressions.
  • Sitemaps report: confirm the new sitemap was read and its URL count matches the site.
  • URL Inspection: spot-check high-value old URLs to confirm Google sees the redirect and the new canonical.

Also check HubSpot. Submit a test on every form, confirm the contact appears with the right source and page history, and check that workflows triggered by those forms still fire.

HubSpot CMS vs Next.js for a B2B site: when is moving worth it?

Moving is not always the right call. The honest comparison depends on who edits the site and what you need it to do.

FactorHubSpot CMSCustom Next.js
EditingDrag-and-drop editor for marketersDepends on the CMS or editing workflow you pair with it
Performance controlLimited by HubSpot themes and modulesFull control over scripts, images and rendering
Structured dataAdded per module or in header HTMLGenerated per template from your content
Custom tools (calculators, catalogs)Possible, but constrainedBuilt as normal app routes
CRM integrationNativeVia embed code, Forms API and tracking code
RedirectsManaged in HubSpot settingsManaged in code or at the host

Stay on HubSpot CMS if your team builds many campaign pages weekly without developer help and the site already performs well. Move if speed, custom tools or AI search visibility are holding back the site that drives your leads. Server-rendered pages with schema on every template, covered in our guide to schema that moves the needle, are easier to keep consistent in code.

What one migration looked like

ebb Logistics, a parcel contract consulting firm, moved about 400 URLs, ten calculators and 330+ articles to a custom Next.js site in early October 2026. Every old URL resolved to a live page or a 301 redirect on launch day, and 0 rankings were lost at cutover (Google Search Console, checked daily).

Ranking keywords went from about 475 at migration to 958 on Dec 1, 2026 (Semrush, US, top 100). Google impressions rose 800% in the first month versus the month before (Google Search Console). That is one site's result, not a forecast for yours. The full story is in the ebb Logistics case study.

Planning to leave HubSpot CMS but keep the CRM?

We will review your HubSpot URL patterns, redirect list and form setup on a 30-minute call, then send a fixed proposal.

Book a discovery call →

Frequently Asked Questions

Will we lose Google rankings if we move from HubSpot CMS to Next.js?▼
Not if every indexed URL resolves to a live page or a single permanent redirect on launch day. Losses usually come from missed URL patterns, such as blog tag pages or old HubSpot redirects that stopped working when the domain moved, not from the platform change itself.
Can we keep using HubSpot CRM after leaving HubSpot CMS?▼
Yes. The CRM, contacts, deals, workflows and email tools are separate from website hosting. You install the HubSpot tracking code on the new site and connect forms with embed code, the Forms API or the non-HubSpot forms tool.
Do HubSpot URL redirects keep working after migration?▼
No. HubSpot says its URL redirects only work for domains connected to and hosted in HubSpot. Export the full redirect list before cutover and rebuild each rule in Next.js or at your host, pointing directly to the final URL.
Is a 308 redirect from Next.js as good as a 301 for SEO?▼
Google's documentation lists both 301 and 308 as permanent server-side redirects. Next.js uses 308 for permanent redirects in next.config.js so the request method is preserved. Either signals to Google that the move is permanent.
Should we keep HubSpot blog tag pages?▼
Keep the tag pages that earn impressions or clicks in Search Console and rebuild them as real topic pages. Redirect thin tag pages to the closest relevant hub or article. Avoid sending them all to the blog home or homepage.
Can our marketing team still build landing pages without developers?▼
Yes, if you plan for it. Some teams keep campaign landing pages on a HubSpot-hosted subdomain. Others add a content workflow to the Next.js site with approved templates, so marketers publish pages without touching code.

Want a site built to be cited in AI search, without losing your rankings?

We redesign and migrate established websites with every URL and redirect accounted for, structure them for Google AI Overviews, ChatGPT and Perplexity, then build in a content engine that drafts pages like this one for your editor to approve.

No lost rankings at launchStructured for AI searchSchema & internal links generatedScheduled maintenance