Migrate off WordPress to Static Astro + Cloudflare
Ditch plugin updates, slow database queries, hacked themes, and $25–$100/month managed WordPress hosting — while keeping every Google ranking intact.
MIGRATION WORKSPACE
Move carefully. Keep control.
7 steps
Step 1 of 7
1. Inventory every live URL before changing anything
Open https://yourdomain.com/sitemap_index.xml or /wp-sitemap.xml (Yoast, Rank Math, or WordPress core) and save the full list of published pages, posts, and categories.
3. Rebuild pages cleanly in Astro (not raw Elementor/Divi HTML soup)
Resist the temptation to copy-paste messy page-builder shortcode HTML. Convert pages into clean semantic Astro components or Markdown posts inside src/pages/ or src/content/.
Hours spent fixing broken plugin updates or malware cleanups
What you gain immediately
Zero database or PHP attack surface — impossible to infect with WordPress plugin exploits.
Sub-second page loads globally on Cloudflare Edge (typically jumping from 40–60 to 95–100 Lighthouse Performance).
$0/month static hosting and clean semantic HTML that Google and AI engines parse effortlessly.
1. Inventory every live URL before changing anything
Open https://yourdomain.com/sitemap_index.xml or /wp-sitemap.xml (Yoast, Rank Math, or WordPress core) and save the full list of published pages, posts, and categories.
Also check Google Search Console → Pages / Performance to identify your top traffic-driving URLs — every single one of those must either keep the exact same URL path or get a 301 redirect.
Quickly pull your current WordPress sitemap URLs
curl -s https://yourdomain.com/sitemap_index.xml
# Save every active page and post URL into a spreadsheet: Old URL -> New URL
2. Export your content & media library
In WordPress Admin, go to Tools → Export → All content to download your XML archive (posts, pages, metadata).
Download your full wp-content/uploads/ folder via SFTP or your host's file manager so you keep every original image.
Keep a local backup archive OUTSIDE your public Astro build folder (never put database dumps or wp-config.php inside your public Git repo!).
3. Rebuild pages cleanly in Astro (not raw Elementor/Divi HTML soup)
Resist the temptation to copy-paste messy page-builder shortcode HTML. Convert pages into clean semantic Astro components or Markdown posts inside src/pages/ or src/content/.
Optimize uploaded images to WebP/AVIF and store them in public/images/ or src/assets/.
4. Build your public/_redirects 301 map
Match your highest-value URLs identically where possible (e.g., /services/ stays /services/).
For any URL that changes (old date-based blog paths like /2023/04/my-post/, /category/..., or .php URLs), map every old path to its new clean URL in public/_redirects with status 301.
5. Replace WordPress forms & dynamic widgets cleanly
Replace Contact Form 7 / WPForms / Gravity Forms with a static HTML form connected to Formspree, Basin, or a Cloudflare Turnstile + Worker handler.
Note: If you run complex WooCommerce eCommerce with hundreds of SKUs and customer accounts, keep WooCommerce or use Shopify/Stripe Checkout links instead of forcing a full store into static HTML.
6. Verify on staging, cut over DNS, and keep WordPress as a 14-day safety net
Deploy your Astro repo to Cloudflare Pages and test every URL, 301 redirect, image, mobile layout, and form on your *.pages.dev staging address.
Back up your existing DNS/MX records, connect your custom domain in Cloudflare Pages, and verify HTTPS + email delivery.
Keep your old WordPress hosting paused/archived for 14 days as a rollback safety net before cancelling billing.
Example 301 redirect map (public/_redirects)
Cloudflare Pages natively executes 301 redirects from public/_redirects at the edge before your HTML is even served.
Never commit wp-config.php, .sql database backups, or WordPress admin credentials into your GitHub repo.
Check if your old WordPress host was also hosting cPanel email (mail.yourdomain.com) — migrate email to Google Workspace, Microsoft 365, or Fastmail BEFORE cancelling WordPress hosting.
WordPress often generates /author/, /tag/, and /feed/ URLs; only redirect paths that have real backlinks or search traffic.