Skip to content
James Ross
articlePublished Updated 9 min read

Moving 15 WordPress sites to Cloudflare Workers

By James Ross

Fifteen WordPress sites were converted to static Astro builds on Cloudflare Workers, and three more domains launched as new sites alongside them, for 18 live sites. The cutover ran on 2026-11-13, with a redirect map built from six weeks of traffic logs, parity checks before DNS moved, and a per-site rollback path.

Heavy site machines converted by a build press into light static pages spread across edge nodes, showing WordPress to Cloudflare Workers.

Why move 15 WordPress sites off WordPress at all?

Fifteen small WordPress installs mean fifteen PHP runtimes, plugin trees, databases, backup jobs and admin panels to keep patched, for sites whose pages change a few times a week. Replacing the runtime with prebuilt HTML removes that maintenance surface instead of hardening it.

The sites in this fleet were not ecommerce. They were content and small-business brochure sites with roughly 5,000 to 30,000 visitors each, mostly running Elementor or a page builder on top of a stock theme. Each one needed PHP security updates, plugin compatibility checks and database backups. None of them needed a database query to render an article.

The conversion kept the design of each site rather than lifting the old HTML. One Astro theme was written per WordPress theme, so the output looks like the site the owner knew, without the plugin CSS, jQuery and page-builder wrapper divs underneath it.

What does the 18-site architecture look like?

The whole fleet is one monorepo with a shared core, one theme package per WordPress theme, and one site directory per domain. Each site becomes its own Cloudflare Worker with a custom domain, and the Worker has no request-time script unless a form needs one.

repo/
  packages/core/            SEO head, schema.org, sitemap, RSS, image helpers
  packages/themes/<theme>/  one Astro theme per WordPress theme
  sites/<domain>/           astro.config, wrangler.jsonc, content, public/_redirects
        |
        |  build
        v
  dist/  ->  Worker (static assets)  ->  custom domain

A few decisions carried most of the weight:

  • One Worker per site. A shared Worker would couple 18 domains to one deployment and one rollback. Separate Workers let a bad build roll back one site.
  • Assets only where possible. With no main script, an HTML request is served by the static asset layer. Cloudflare bills asset requests as free and unlimited; only Worker invocations are metered (billing).
  • Custom domains declared in code. Each wrangler.jsonc declares routes: [{ pattern: "<domain>", custom_domain: true }] and workers_dev: false. A deploy reattaches the domain, which matters for both cutover and rollback (Custom Domains).
  • Content is Markdown in Git. WordPress stopped being the publishing surface at cutover. New posts land as files, and the build hides posts marked draft: true or dated in the future.
  • No analytics script. Cloudflare Web Analytics replaced GA4 across the converted sites, so there is no third-party tag to manage per domain.

Where a site needs a contact form, a small Worker handles POST /api/contact and the assets config lists /api/* under run_worker_first. That keeps every HTML route on the asset path while still validating a form, checking a honeypot and a fill-time field, and sending mail through Cloudflare’s email API without storing anything in a database.

How was the WordPress content imported into Markdown?

The import was a repeatable pipeline, not a one-off scrape. It started from the WordPress database and the rendered pages, then produced Markdown, frontmatter, images and a URL map that could be re-run.

  1. Export from the server. For each site, wp db export, the uploads directory and the active theme (plus parent theme) went to a staging directory, pulled with one rsync, then removed. One SSH connection carried the whole batch because the host banned bursts of connections.
  2. Crawl the live site. Sitemaps gave every URL; the crawl saved rendered HTML and desktop and mobile screenshots. That archive was the parity baseline and the only usable source for pages whose layout lived inside Elementor’s JSON.
  3. Convert posts and pages. Classic and block posts went from SQL to Markdown with turndown plus cleanup rules for shortcodes, captions, galleries and embeds. Elementor pages were extracted from the rendered HTML rather than reconstructed from the builder data.
  4. Carry the SEO metadata. Rank Math and Yoast titles, descriptions, canonicals, robots directives and Open Graph values became frontmatter fields, with crawl data overriding where the plugin output and the rendered page disagreed.
  5. Copy only referenced images. Each image used by a page became one optimized master in the repo. WordPress size variants were not copied; old /wp-content/uploads/ URLs either resolved to the master or redirected to it.
  6. Write the URL map. Every legacy URL got a destination before anything was deleted, which is the input to the redirect step below.

Two details saved trouble later. Thirteen posts that WordPress had missed scheduling were imported as draft: true rather than published by surprise. And the generated _redirects file was treated as build output: hand-written rules went into a separate redirects.manual file that the importer merged in first, because a re-import overwrites the generated file.

How do you build a 301 map you can trust?

The redirect map came from the old sitemap plus six weeks of real access logs, not from a crawler alone. A crawler finds pages that exist; the logs find URLs that people and search engines actually request, including feeds, attachment pages and old pagination.

The traffic check covered 13,134 URLs that had received requests. Each one was tested against the new build: a 200 was fine, a single 301 to a 200 was fine, and anything else counted as a regression. The first pass left 8.0% of human hits on regressed URLs. Curating redirects against the access logs brought that to 3.5%, with most of the remainder deliberate: empty search terms, front-page pagination and missing favicons.

The rules were deliberately boring:

  • Never redirect a path to itself.
  • Never write a rule that shadows a live page on the new site.
  • Never remove or merge a URL that has backlinks.
  • Put static rules before dynamic ones, and use one splat per rule.
  • Keep the file under 2,000 static and 100 dynamic rules, because that is the hard limit for _redirects (Cloudflare docs).
Legacy pattern Destination Code
/index.php/* /:splat 301
/category/* / 301
/tag/* / 301
/author/* / 301
/feed/ /rss.xml 301
/wp-login.php, /xmlrpc.php blocked at the zone 403
/wp-admin/*, /wp-json/* no destination 404

The largest site in the fleet landed at about 1,220 rules, roughly 60% of the file limit. Any fleet meaningfully larger than this needs Bulk Redirects rather than a bigger _redirects file.

What did the DNS cutover involve?

Cutover was five DNS changes per zone, done in a fixed order so a failure could be reversed without guessing.

  1. Attach the apex as a Workers Custom Domain on the site’s Worker. Cloudflare creates the DNS record and certificate itself (Custom Domains).
  2. Delete the old apex A record that pointed at the cPanel server.
  3. Add a proxied AAAA 100:: placeholder on www where no www record existed, so a redirect rule can catch it. Custom Domains match an exact hostname, so www needs its own record and a redirect.
  4. Create a Single Redirect ruleset: www to apex, and http to https, both preserving path and query string.
  5. Leave MX records, verification TXT records and unrelated subdomains untouched.

Two things stayed off on purpose. WordPress stayed installed on the server, with no DNS pointing at it, so the old content was still available for re-export. And “Always Use HTTPS” stayed off because the redirect rule already handled the http-to-https hop, and two mechanisms doing the same job makes failures harder to read.

A live check sampled 626 URLs across the 15 zones: 625 returned 200 or a single 301. The one holdout was a known slug containing a non-breaking hyphen. Each site also had a documented rollback: remove the custom domain, restore the old A record, and remove the routes entry from that site’s wrangler.jsonc. Skip the last step and the next deploy quietly reattaches the domain.

How are 18 sites built and deployed?

Builds started on Workers Builds with per-site root directories and watch paths, then moved to a self-hosted build machine on 2026-11-16. The reason was queueing: a change to packages/core or the lockfile touches every site’s watch path, so one shared change queued 15 builds in a system optimised for occasional deploys.

The self-hosted path is a systemd timer that polls the branch, rebuilds only the sites whose inputs changed, hashes dist/, skips identical uploads, runs wrangler deploy, and writes a heartbeat. A per-site flock prevents two builds writing the same dist/ directory. Rollback tags make a bad build a known previous state rather than a git archaeology exercise.

The quality gates run before any deploy:

  • a strict content validator over every page;
  • a redirect check that every old URL still returns 200 or one 301 to a 200;
  • visual QA at three widths in both light and dark mode;
  • axe accessibility checks;
  • Lighthouse mobile against a written target of at least 90 performance, 95 accessibility, 95 best practices and 100 SEO.

That pipeline ran with 15 to 20 agents working at once and a cap of about six concurrent browsers, because Lighthouse scores stop being comparable when a machine is oversubscribed. The 128 request and report files that coordinated the parallel work are covered in coordinating 15 WordPress conversions with agent waves.

WordPress origin vs static Astro on Workers

Attribute WordPress on cPanel Static Astro on Cloudflare Workers
Runtime per page view PHP-FPM plus MySQL none; a prebuilt asset
Patch surface core, plugins, themes, PHP build dependencies only
Content editing wp-admin, non-technical friendly Markdown in Git or a Git-based editor
Deploy and rollback files and database on a server build, upload, redeploy a previous version
Redirects plugin rules evaluated at the origin _redirects, capped at 2,100 rules
Traffic spike origin capacity and PHP workers Cloudflare’s edge
Per-request compute every request only routes you mark run_worker_first
Failure mode database, PHP upgrade, plugin CVE bad build, caught before deploy

Which should you choose?

Choose static Astro on Workers for content sites, brochure sites and documentation where the page is the same for every visitor. The operational win is real: no PHP to patch, no database to back up, no origin to fall over, and a rollback that is a redeploy rather than a restore.

Stay on WordPress or WooCommerce when the site needs plugins that do server-side work, logged-in customers, checkout, editorial workflows for non-technical staff, or a page builder the owner actually uses. Static hosting does not remove those requirements; it just makes them someone else’s problem at the edge, badly.

What broke and what we changed

Redirect regressions hid in the long tail. A crawler-only map left 8.0% of human hits on broken or wrong URLs. The fix was to treat access logs as the source of truth and score every URL, which brought it to 3.5%. The lesson generalises: after a migration, the sitemap is a hypothesis and the logs are evidence.

A build step broke site search on every live site. A code-scrambling step meant to vary each site’s markup was mangling the JavaScript behind site search. The release gates did not catch it, which is why all 18 sites were re-gated and redeployed.

Re-importing wiped hand edits. Running the importer again rebuilt src/content from the database snapshot and regenerated _redirects, overwriting both. A content lock file plus a separate manual redirects file made re-imports safe. The database snapshot is now a starting point, not the live source.

Turning off workers_dev removed previews. Setting workers_dev: false was correct for duplicate-content reasons, but it also removed the preview URLs the workflow depended on. Previews moved to wrangler versions upload and local pnpm preview.

A token was printed in a session log. A script mistake echoed an API token during setup. It was rolled immediately with the same scope and expiry. The backup env file that still held credentials was flagged for deletion, and secrets now stay in one env file and are never echoed.

Frequently asked questions

How long does a WordPress to Workers migration take?

For 15 small sites, the conversion itself reached live Workers in one day, on 2026-11-13, because the import pipeline and themes were built in parallel by agents. The content and SEO refresh that followed ran for several more days. A single site with a custom theme is a smaller job, but the redirect and parity work is the part that sets the timeline, not the Astro build.

Do you lose SEO rankings when moving WordPress to static hosting?

Not if every legacy URL returns 200 or one 301 to a 200, and titles, canonicals and meta descriptions match what the old site served. This migration compared each Worker build against the live WordPress site before DNS moved, including every URL in each sitemap. Rankings can still move for other reasons, so the redirect map and parity check are the minimum, not a guarantee.

Can you still publish scheduled posts on a static site?

Yes. The build hides posts with a future date, and a nightly systemd timer calls each Worker's deploy hook so a post appears on its scheduled day. The alternative is a build triggered by the publishing tool. Either way, the site does not need a database to hold a future post.

What happens to WordPress after the cutover?

It stays installed on the server with no DNS pointing at it, which keeps the old content available for re-export while the static sites prove themselves. Decommissioning is a separate phase: archive the files and database, then remove the docroot and database. Mail is the constraint, because MX records may still point at that server.

Which Workers plan does a fleet like this need?

This fleet ran on the paid plan, which raises the static asset limit from 20,000 files per version to 100,000; a single file stays capped at 25 MiB on both plans. Asset requests are free and unlimited either way, so the plan choice is about file count and Worker invocations, not page views (Workers limits).

How do contact forms work without a server?

A small Worker handles POST /api/contact. The assets configuration marks /api/* with run_worker_first, so only those requests invoke the Worker; every HTML route is served as a static asset. The Worker validates the input, checks a honeypot and a fill-time field, rate-limits by IP, and sends mail through an email API. No database is involved.

Can a single site be rolled back?

Yes. Remove the custom domain from the Worker, restore the old A record, and delete the routes entry from that site's wrangler.jsonc. That last step is the one people forget: without it, the next deploy or nightly hook reattaches the custom domain and overrides the DNS record.