MIGRATION PLAYBOOK · WORDPRESS → ASTRO + CLOUDFLARE

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.

Open full instructions
Example preview01
1. Inventory every live URL before changing anything
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 2 of 7

2. Export your content & media library

In WordPress Admin, go to Tools → Export → All content to download your XML archive (posts, pages, metadata).

Open full instructions
Example preview02
2. Export your content & media library
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 3 of 7

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/.

Open full instructions
Example preview03
3. Rebuild pages cleanly in Astro (not raw Elementor/Divi HTML soup)
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 4 of 7

4. Build your public/_redirects 301 map

Match your highest-value URLs identically where possible (e.g., /services/ stays /services/).

Open full instructions
Example preview04
4. Build your public/_redirects 301 map
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 5 of 7

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.

Open full instructions
Example preview05
5. Replace WordPress forms & dynamic widgets cleanly
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 6 of 7

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.

Open full instructions
Example preview06
6. Verify on staging, cut over DNS, and keep WordPress as a 14-day safety net
01Read instructions
02Review staging changes
03Verify before cutover

Illustration · not connected to your accounts

Step 7 of 7

Check redirects and rollback

Preserve important URLs, test redirects and review platform-specific risks before switching production.

Review redirect map
Example preview07
Check redirects and rollback
01Map old URLs
02Test redirect status
03Keep rollback ready

Illustration · not connected to your accounts

Hidden costs you leave behind

  • Managed WordPress hosting ($20–$70/mo)
  • Paid security, backup, caching, and SEO plugins ($150–$500/yr)
  • Page-builder licenses (Elementor, Divi, WPForms, etc.)
  • 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.

public/_redirects
# public/_redirects — WordPress to Astro 301 map
/2023/04/spring-specials /articles/spring-specials/ 301
/category/news/* /articles/ 301
/about-us.html /about/ 301
/contact-us /contact/ 301

Critical WordPress gotchas to avoid

  • 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.