Most WordPress to Astro moves are boring in a good way. Posts, pages, images, forms, DNS, done. Then a client turns up with WPML, three languages and 400 translated pages, and the boring checklist stops working.
I've done a few of these now. The content is not the hard part. The hard part is that every translated page has its own URL that Google already ranks, and every one of those has to land on the right page in the right language on day one. Here is how I do it.
Step 1: figure out which URL format WPML is using
WPML can run languages three ways, and the whole plan depends on which one the client has:
- Directories:
/fr/a-propos/,/de/uber-uns/. The nice one. - Separate domains:
example.fr,example.de. More DNS work. - Query param:
/about/?lang=fr. The annoying one.
Check WPML > Languages > Language URL format or just click around the language switcher. Write it down at the top of the migration doc because you will forget.
If it's directories, Astro maps across almost one to one. If it's domains or params, I talk to the client about folding everything into directories on one domain. One site, one deploy, one set of redirects. Most of them say yes once you explain they stop paying for three domains worth of hosting headaches.
Step 2: export the translation groups, not just the posts
A normal WP export gives you the posts. It does not tell you that post 812 is the French version of post 140. WPML keeps that in its own table:
SELECT t.element_id, t.trid, t.language_code, t.source_language_code, p.post_name, p.post_title, p.post_type FROM wp_icl_translations t JOIN wp_posts p ON p.ID = t.element_id WHERE t.element_type IN ('post_post', 'post_page') AND p.post_status = 'publish'; trid is the gold. Every row with the same trid is the same page in a different language. I dump this to translations.csv and keep it next to the content export.
Step 3: one content collection, a lang field and a translation key
In Astro I keep every language in one collection and tag each entry:
// src/content.config.ts import { defineCollection, z } from "astro:content"; import { glob } from "astro/loaders"; const pages = defineCollection({ loader: glob({ pattern: "**/*.md", base: "./src/content/pages" }), schema: z.object({ title: z.string(), lang: z.enum(["en", "fr", "de"]), translationKey: z.string(), // the old WPML trid slug: z.string(), oldUrl: z.string(), }), }); export const collections = { pages }; Files go in src/content/pages/en/, fr/, de/. Keeping oldUrl in the frontmatter feels redundant until you need to generate redirects from it. Then it's the best decision you made.
And turn on Astro's built in i18n routing:
// astro.config.mjs export default defineConfig({ i18n: { locales: ["en", "fr", "de"], defaultLocale: "en", routing: { prefixDefaultLocale: false }, }, }); prefixDefaultLocale: false keeps English at /about/ instead of /en/about/, which matches how most WPML sites were set up. Check that against the old site before you copy it.
Step 4: let the coding agent do the boring conversion
I hand translations.csv and the XML export to Claude Code (Cursor works fine too) with something like:
Convert every published post and page into src/content/pages/{lang}/. Use translations.csv: lang = language_code, translationKey = trid. Keep the ORIGINAL slug for every language, even if it looks wrong. Do not translate or "fix" slugs. Set oldUrl to the full old path including the language prefix. If a trid has a missing language, list it in missing-translations.md. Do not machine translate anything. The "do not fix slugs" line is there because an agent will happily turn /fr/a-propos/ into /fr/about/ to be consistant. That's a ranking drop you did to yourself.
The missing translations list is also useful for the client conversation. There's always a handful of pages that only ever existed in English. Better they find out from you than from a German customer.
Step 5: hreflang and the language switcher
Because every entry has a translationKey, building hreflang tags is a simple lookup:
--- import { getCollection } from "astro:content"; const { entry } = Astro.props; const siblings = (await getCollection("pages")) .filter((p) => p.data.translationKey === entry.data.translationKey); --- {siblings.map((p) => ( <link rel="alternate" hreflang={p.data.lang} href={new URL(p.data.lang === "en" ? `/${p.data.slug}/` : `/${p.data.lang}/${p.data.slug}/`, Astro.site)} /> ))} The same siblings list drives the language switcher, so the French page links to the actual German version of itself and not the German homepage. WPML users notice that stuff.
Step 6: redirects from oldUrl
Anything where the new path doesn't match the old one gets a 301. Since oldUrl is in the frontmatter, a tiny script writes the file for me:
/fr/a-propos-de-nous/ /fr/a-propos/ 301 /de/kontakt-2/ /de/kontakt/ 301 I host the client sites on novence.ai, so this just goes in /_redirects in the build output and ships with the deploy. Whatever host you use, generate it from data, never by hand. By hand is how you miss 30 French blog posts.
For the query param sites (?lang=fr), check what your host's redirect rules can actually match before you promise anything. Sometimes the honest answer is a short JS fallback on the old path plus updating the sitemap and letting Google catch up.
Step 7: the per language bits people forget
- Forms. Each language needs its own thank you page and its own error text. I keep the form HTML per language and point each one at its own thank you URL.
- Editable content. Clients with opening hours or prices they edit themselves get one data file per language (
/data/hours.fr.jsonetc) so the French team can fix French text without touching English. - Dates and numbers.
Intl.DateTimeFormat(lang)everywhere. WPML sites often had this sorted by a plugin and you only notice when it breaks. - Sitemap. Use
@astrojs/sitemapwith the i18n option so every language version is in there with its alternates.
Step 8: check it before DNS moves
Before I touch DNS I deploy a preview (npx novence deploy for me) and run the old URL list against it:
while read url; do code=$(curl -s -o /dev/null -w "%{http_code}" "$PREVIEW$url") echo "$code $url" done < old-urls.txt | grep -v "^200\|^301" Empty output means every old URL either loads or redirects. Anything else gets fixed before launch. I also spot check five random pages per language by hand, because a 200 on the wrong language is still a bug.
What I'd tell you if you're quoting one of these
Price it as one migration per language plus a bit, not one migration. The extra languages are faster than the first, but the URL mapping and the missing translations conversation take real time. And put "we are not translating anything" in writing. Someone always asks.
Done right, the client ends up with one fast site, every language on it, and nobody in Google Search Console panicking two weeks later. That's the whole job.

