How to migrate a WordPress site to Astro without losing rankings

Rankings belong to URLs, not to pages. A migration that rebuilds every page perfectly and forgets one address has still moved house without leaving a forwarding address, and nothing on the new site will tell you.

Short answer

Keep every URL that still has a page, send every moved URL to its final page in a single permanent redirect, let spam and dead URLs return 404 or 410, carry the copy over word for word, and change only the two DNS records that point at the website.

SEO Published
Book a strategy callAll insights

This is the order we run a WordPress to Astro move in, written from the two we have taken live this autumn and one more that is built and waiting on DNS. Both live sites were on Flywheel and both had been hacked, which turns out to be the normal case rather than the exception. It includes the mistake we found on our own work while writing it.

01

What losing rankings actually is.

Google does not rank your site. It ranks addresses. Every link anyone ever pointed at you, every signal it has gathered about a page, is attached to a URL string. Change the string and you have a new page with no history, unless something tells Google the old one moved.

So a migration loses rankings in exactly three ways. An old URL now answers 404 when it had a real page behind it. An old URL redirects somewhere that is not its equivalent. Or the content behind a kept URL changed enough that it no longer answers what it used to. Everything else people worry about, the framework, the host, the speed, is either neutral or helps.

That reframes the whole job. You are not rebuilding a site. You are making a promise about a list of addresses, and the rebuild is the thing you do while keeping it.

02

Build the list of URLs before you build the site.

The list is every URL the old site answers, not every page in the menu. Those are different numbers on every WordPress site I have opened, and the difference is where rankings go to die.

Pull it from five places and merge them: the old sitemap, the pages report in Search Console, captures in the Wayback Machine, the media library through the REST API at /wp-json/wp/v2/media, and the links in the site's own nav and footer. Each one finds things the others miss.

On the law firm, the Wayback Machine was the only source that still worked. The hacked install had replaced the home page with casino spam and every real page answered 404, so the live site could not tell us what it used to be. We rebuilt the URL list and the copy from 2019 captures, and the art from the firm's 2018 design files. That came to 15 real URLs.

On the nonprofit, the list turned up a theme demo shop, demo blog posts and five test pages called things like /aaa/ and /no/, all still live and all in the sitemap. Nobody at the client knew they existed. Google did.

One list in, three outcomes out. The list is the deliverable; the site is how you keep it.
03

Decide every URL: keep it, move it, or let it go.

Each address on the list gets exactly one of three answers, written down before any code exists.

  • Keep it. The page still exists and can live at the same path. This is the best outcome and it should be the default. On the personal site, 7 of the paths kept their exact addresses.
  • Move it. The page exists under a new address. It gets one permanent redirect to that address and nowhere else. On the law firm, /service/ivc-filter became /practice-areas/ivc-filter.
  • Let it go. Spam, test pages, a plugin's leftovers. It answers 404 or 410 and is not redirected.

The temptation is a fourth answer: redirect everything you cannot place to the home page. It feels safe because nothing 404s. It is not safe. A permanent redirect tells Google the target should now be treated as the page, and a home page is not the page a product or a blog post used to be. The redirect is making a claim that is not true.

I will be straight about our own record here. On the nonprofit we did send the theme's demo shop and test pages to the home page, on the reasoning that none of them had ever been real content. That is defensible for pages nobody linked to. It would be wrong for anything with links or traffic, and the test is Search Console, not a guess.

What the old URLs became on the two live migrations, read off each site's redirect config and launch record on 3 November 2026.
Old URL typeWhat we didStatusWhy
Real page, same pathKept the path, dropped the trailing slash200, after a 308 for the slashNothing changes for Google but the slash
Real page, new pathOne redirect to the new page308The law firm's /service/* became /practice-areas/*
Old sitemap.xml and wp-sitemap.xmlRedirect to the new sitemap index308Search Console and crawlers still request the old ones
/feed, /comments/feedRedirect to the home page308A feed reader, not a page with rankings
/wp-login.php, /loginTemporary redirect to the firm's real client login307People still type it; it must not be cached as permanent
Old PDFs under /wp-content/uploadsRedirect to the same file at its new path308Other sites link straight to the file
Injected spam posts410 on the law firm, 404 on the personal site410 or 404Google treats both the same
04

Match WordPress's trailing slash, on purpose.

WordPress publishes pretty permalinks with a trailing slash: /who-am-i/, not /who-am-i. That slashed form is what Google has indexed and what other sites have linked to. Astro on Vercel does not care either way until you tell it, and you should tell it, because two working addresses for one page is the exact problem a canonical exists to solve.

We set trailingSlash to false in vercel.json on every one of these, which makes Vercel answer a slashed path with a 308 to the version without the slash, and we make every canonical and every internal link use the no-slash form. That keeps one address per page. It also costs a redirect on every old URL, which is fine on its own and is the start of the mistake in the next section.

If you would rather keep the slash, keep it everywhere: the config, the canonicals, the sitemap and every link. Mixing them is the version that hurts. The long form of why is in the piece on canonical URLs.

05

Redirect in one hop, to the final page.

Google's own guidance on site moves is to redirect "to the final destination directly", and to keep chains low, "ideally no more than 3 and fewer than 5". Googlebot will follow up to 10, so a two-hop chain is not going to drop a page. It is still a round trip on every request and a slower, weaker signal, and it is the thing I check for on our own site.

Here is the part I did not expect to write. While checking the two live client sites for this piece, on 3 November, every old WordPress URL in its slashed form took two hops, not one. Vercel strips the slash first, answering /service/ivc-filter/ with a 308 to /service/ivc-filter, and only then does our redirect rule run and send it on to /practice-areas/ivc-filter.

Measured with curl on 3 November 2026. Both paths land on the right page. Only one of them does it in a single round trip.

Add the host and the protocol and it compounds. The worst case on the law firm, the old http://www address with its slash, took 4 hops: http to https, www to the bare domain, the slash, then the rule. Every one of those landed on the right page with a 200. None of them went there directly.

Redirect hops on the two live migrations, measured with curl on 3 November 2026. Every row lands on the correct page with a 200.
SiteOld URL as requestedHopsLands on
Law firmhttps, bare domain, /service/ivc-filter1/practice-areas/ivc-filter
Law firmhttps, bare domain, /service/ivc-filter/2/practice-areas/ivc-filter
Law firmhttps, www, /service/ivc-filter2/practice-areas/ivc-filter
Law firmhttp, www, /service/ivc-filter/4/practice-areas/ivc-filter
Personal sitehttps, www, /who-am-i/1/who-am-i
Personal sitehttps, www, /about/2/who-am-i
Personal sitehttp, bare domain, /who-am-i/3/who-am-i

The reason we missed it is the useful part. This site has a script that walks every URL it has ever answered, 307 of them, and fails the build if any takes more than one hop. The client sites had a redirect map and a crawl that confirmed every old URL reached the right page. Reaching the right page and reaching it in one hop are different checks, and only one of them ran.

So the rule, as we now run it: test the old URL in the exact form Google holds it, slash, www, http and all, and count the hops rather than checking where it lands. curl does it in one line: curl -sIL followed by the old URL, and count the 308s.

06

301 or 308 does not matter, permanent does.

People lose an afternoon to this one. Vercel's redirects answer 308 when you mark them permanent, not the 301 every SEO checklist asks for. Google's documentation puts both in the same group: "The 301 and 308 status codes mean that a page has permanently moved to a new location," and for both, the indexing pipeline uses the redirect as a signal that the target is the canonical.

What does matter is permanent against temporary. A 307 or 302 tells Google the old address is coming back, so it keeps the old one. Use a temporary redirect only where that is true. On the law firm the old /wp-login.php now goes to the firm's real client login on another service, and that one is a 307 deliberately, so nobody's browser caches it forever.

And keep them. Google says to keep site-move redirects "generally at least 1 year". In practice we never take them out. The rules live in vercel.json in the client's own repository, they cost nothing to keep, and a link from 2019 on somebody else's site will still be there in 2030.

07

If the old site was hacked, clean Search Console first.

Both live migrations were hacked WordPress installs on Flywheel, and in both cases the damage that mattered for rankings was not on the site. It was in Search Console.

The attacker had verified themselves as an owner of each property, on the law firm through a file dropped on the hacked install on 17 March 2026, and had submitted their own sitemap. The law firm's listed 7,775 spam URLs under /gamble/. The personal site's listed 7,614 under /gambling-games/. Moving the site does nothing about either. The attacker stays an owner, the spam sitemap stays submitted, and the spam URLs stay in the index until Google recrawls them.

So the order on cutover day was: remove the attacker as an owner, delete their sitemap and the dead WordPress one, submit the new sitemap, file temporary removals for the spam prefixes, and request a recrawl of the home page. On the personal site, one removal request would not submit after two tries. That URL answers 404 now, so it drops out on its own when Google next crawls it.

Check the owners list even if you do not think the site was compromised. The personal site's spam was two posts under fake author IDs, published a year apart, and nobody had noticed either one.

08

404 or 410 for the spam: it does not matter.

The received wisdom is that a 410 Gone gets a URL dropped faster than a 404 Not Found. We used both, a 410 for the law firm's spam paths and a plain 404 for the personal site's, mostly because the two sites were built on the same day with slightly different instincts.

Google's documentation settles it: "All 4xx errors, except 429, are treated the same", and for each one the crawlers report that the content does not exist. Pick whichever is easier to configure. What matters is that the spam answers a 4xx at all, rather than redirecting to the home page, which would tell Google your home page is the new home of 7,775 gambling posts.

09

Carry the copy over word for word, and prove it.

A migration is not the moment to rewrite. If a kept URL changes what it says, Google has to work out whether it still answers the same query, and a rewritten page sometimes does not. Move first. Improve later, one change at a time, with the old version in git to compare against.

We prove it with a script rather than by reading. On the personal site, a parity check pulls every sentence and every outbound link from the captured WordPress pages and looks for each one on the rebuilt page. It reported 104 of 104 sentences present on one page, 68 of 68, 20 of 20 and 10 of 10 on the others, and no outbound link missing. The one deliberate change was a job listed as "2020 – 2020", which became "2020".

Port the markup as well as the words where the design is staying. A hand-written rewrite over the old stylesheet looks plausible in a screenshot and wrong beside the live site. Always put the two side by side before calling a page done.

Images are the one place to change things freely, because nobody ranks for a file size. The nonprofit's media library was 76 MB, of which 1.7 MB is actually used after conversion to WebP. The personal site went from 22 MB of originals to about 1 MB. Serve them from the new host, never hot-linked from the old one, because the old one is about to be switched off.

10

Keep the analytics and the verification alive.

Before cutover, find out how the old site proves it owns its Search Console property. On the law firm it was a DNS TXT record, which survives the move untouched as long as nobody deletes it. On the personal site there was no verification at all, so we added an HTML file to the new site's public folder and verified that. Do not delete that file later; the property quietly loses its verified owner.

Then the analytics. The law firm had a Universal Analytics property, which Google has retired, and no GA4. The personal site loaded no analytics at all. We installed GA4 on both and confirmed hits in Realtime.

There is a trap specific to Astro here, and it caught us on both sites. Put the GA4 snippet in a script tag with define:vars so you can pass the measurement ID in, and Astro wraps that script in its own scope. The gtag function is no longer global. Page views still arrive, because the snippet calls gtag itself, so Realtime looks fine. Every custom event your forms send, generate_lead included, silently does nothing. The symptom is a site with traffic and no conversions.

Test the event, not the page view. Submit a real form and watch the request leave the browser.

11

Change two DNS records and nothing else.

Pointing the domain at Vercel is two records: the A record on the bare domain and the CNAME on www. That is the whole change. Every other record in the zone belongs to something else, and the something else is usually email.

Record the whole zone before you touch it. On the law firm it held 5 Google MX records, an SPF record and the Search Console TXT record, and all of them had to stay exactly as they were. On the nonprofit, real email lives on a different domain entirely, and the site domain's MX record points at a mail host that no longer exists. We left it alone too. Fixing someone's email is a different job from moving their website, and doing it by accident on cutover day is how a migration becomes the week nobody got any mail.

Expect one thing to lag. On the personal site the certificate for the new host had not issued by the time DNS moved, and it took a manual vercel certs issue to finish. Check https on both the bare domain and www, from a phone off your own network, before you tell anyone it is done.

12

Test before DNS, then test again after.

The rebuilt site lives on a preview address for days before the domain moves. Use that time, and keep the preview host out of the index with a noindex header so the copy does not compete with itself. Then run the same checks again on the real domain, because some of them only mean anything there. The full list is the 5Four Launch Checklist; the migration-specific part is below.

  • BlockerEvery URL on the list answers what the decision said: 200, one 308, or a 4xx.
  • BlockerThe old URLs tested in the exact form Google holds them, slash, www and http included, and the hops counted.
  • BlockerSearch Console owners checked, the old and any spam sitemaps removed, the new sitemap submitted.
  • Copy parity run against the captured old pages, with every deliberate difference written down.
  • BlockerA real form submission delivered, and the conversion event seen leaving the browser.
  • BlockerThe DNS zone recorded before the change, and only the A and www records changed.
  • https checked on the bare domain and www after DNS, from outside your own network.
  • The preview host noindexed, and the production domain indexable.

For scale, the law firm's pre-DNS crawl found 34 URLs, every one answering 200, with its 15 old URLs redirecting to their new pages and the spam paths answering 410. Its new sitemap lists 14 URLs. The site QA ran 16 routes at 11 widths in Chromium and WebKit with no problems. None of that caught the extra hop, which is why the second check in the list above exists now.

13

What the first few weeks look like.

Google is direct about this: "you may experience ranking fluctuations while Google recrawls and reindexes your site," and "a small to medium-sized website can take a few weeks for most pages to move." Old URLs will keep appearing in results for a while. That is not the redirects failing. It is Google not having recrawled yet.

What you watch in those weeks is Search Console's pages report, for anything that should be indexed and is answering 404, and the sitemap status, which on the law firm read "Couldn't fetch" straight after submission. That is normal on day one; look again the next day. Shut the old WordPress install down once you are sure nothing is still being served from it, and keep a full backup first. On a hacked install, rotate any password that was ever reused there.

14

How we checked, and what we cannot show you.

Every figure in this piece was read on 3 November 2026 from the launch records and redirect configs in each client's repository, and the hop counts were measured live with curl the same day. Google's and Vercel's rules are quoted from their own documentation, checked that day. The research file in this site's repository holds every one with its source.

Now what is missing. We cannot show you that rankings held, because we do not have the before and after. Neither live site had a Search Console baseline we exported before cutover, and the two went live on 1 and 6 October, which is inside the few weeks Google itself says a move takes. When there is a quarter of data we will publish it, whichever way it went.

The sample is small, and I want to be exact about it. Two migrations are live. A third is built and waiting on the client's DNS. A fourth was cancelled when the client chose to host it themselves. The largest sitemap among them is 14 URLs.

15

Who should not do this, and who would do it better.

If your WordPress site has thousands of posts, an editorial team that lives in the WordPress editor, and plugins doing real work, an agency that specializes in large WordPress moves, or simply a better WordPress host and a security cleanup, will serve you better than we would today. The URL decisions in this piece scale. Our experience of making them at that size does not exist yet, and the redirect map for a site that size is its own project.

Moving to Astro made sense for these three because they were small, rarely edited, and in two cases already compromised. A static site has no login page to attack and no plugin to fall behind on, and it is fast without trying: the law firm's home page scored 99 on mobile Lighthouse at launch, with a 1.6s LCP. Those are reasons to move a small site. They are not reasons to move every site.

This is the process behind 5Four Migration: every page, post and old URL moved, on a stack in the client's own accounts under the No-Hostage Rule.

Related: SEO in the glossary, what a static site generator is, why one page needs one address.

John D Saunders, Founder / Creative Director at 5Four Digital
Written by
John D. Saunders
Founder / Creative Director, 5Four Digital

Designer, developer and educator in Miami. I run strategy and creative direction at 5Four Digital, a web design and development agency that leans on AI. I have spoken at AIGA, Adobe MAX and Webflow Conf, and I put the whole process on YouTube.

More about John

Common questions, answered.

Not by itself. Google ranks URLs and what they say, not the framework that served them. A move hurts when old URLs start answering 404, redirect to something that is not their equivalent, or change what they say. Keep every URL that still has a page, redirect every moved one to its final page in one hop, and carry the copy over unchanged, and the framework is irrelevant.

Ready to stop paying the Ticket Tax?

Book a 30-minute call. We'll look at what you have, tell you which system to start with, and give you a clear price range before you leave the call.

Book a strategy callSee the Approval Loop