Migrating a live WordPress site is routine work, but it's also where a lot of avoidable disasters happen — broken database prefixes, hardcoded URLs, DNS mishaps that take a site offline for hours. Here's a process that sidesteps the common failure points.
1. Stage the migration before touching DNS
Never migrate by pointing DNS at a half-finished setup. Instead:
- Provision the new environment first.
- Copy files and export/import the database while the old site keeps serving live traffic.
- Verify the new environment fully — as a staging copy, reachable by IP or a temporary hostname/hosts-file entry — before any DNS change.
This means the live site is never down mid-migration; visitors keep hitting the old server until the new one is confirmed working.
2. Handle the database correctly
The database migration is where most WordPress-specific mistakes happen:
- Search-and-replace URLs properly, not with a naive find-and-replace on the raw SQL dump. WordPress serializes some data (widget settings, some plugin options) as PHP serialized arrays, which store string lengths alongside the string — a straight text replace that changes string length corrupts that data. Use a tool built for this (WP-CLI's
wp search-replace, or a dedicated migration plugin). - Match the table prefix between source and destination, or update
wp-config.php's$table_prefixto match what was actually imported. - Export with a consistent character set (utf8mb4) to avoid mangled text, especially with non-Latin content or emoji.
3. Copy files completely, including what's easy to forget
wp-content/uploads(all media)wp-content/pluginsandwp-content/themes, including any custom code not in a public repo- Any custom
mu-plugins .htaccessor nginx config equivalents for custom rewrite rules
Skip core WordPress files themselves — reinstall fresh on the destination rather than copying, to avoid dragging over stale or incompatible versions.
4. Verify before cutover
On the staged copy, check:
- Homepage and a sample of inner pages load correctly, with images and styles intact
- Forms submit successfully (test emails, not just the UI)
- Any custom functionality specific to the site (checkout flow, membership gating, custom API integrations)
- PHP error logs are clean
5. Cut over with a short, controlled DNS change
- Lower the DNS TTL 24–48 hours in advance so the eventual change propagates fast instead of being cached for hours.
- Do a final database sync immediately before the cutover to capture any content changes made during migration prep (comments, orders, new posts).
- Update DNS, then monitor both the old and new server logs to confirm traffic is shifting as expected.
- Keep the old environment running and untouched for a few days as a rollback option before decommissioning it.
6. Post-migration checklist
- Confirm SSL is issued and working on the new environment
- Re-verify the site in Search Console/Analytics if the domain or protocol changed
- Check that scheduled tasks (WP-Cron, any server cron jobs) are running on the new host, not still pointed at the old one
- Purge any CDN or edge cache that might be serving stale content from before the migration
The takeaway
The pattern that avoids downtime is simple: build and fully verify the new environment before it's live, then make DNS the very last step — not the first. Most migration horror stories come from skipping the verification step and discovering problems only after the domain is already pointed at the new server.
