How to Migrate a WordPress Site

Category: WordPress Hosting ยท Updated 2026-11-13

Migrating WordPress means copying its files and the wp-content folder, exporting and importing the MySQL database, updating the site address everywhere it is stored, including inside serialized data, and pointing DNS to the new host. A migration plugin or the WP-CLI search-replace command handles the URL rewrite safely, since a plain text find-and-replace can corrupt serialized data and break the site.

What a WordPress migration actually moves

  • wp-content folder: themes, plugins and the uploads folder with every image and file ever added.
  • The database: posts, pages, comments, settings and the options table, which also stores the site's web address.
  • Core WordPress files: usually safer to install a fresh copy on the new host rather than copy old core files over.
  • wp-config.php: rewritten on the new host with the new database name, username and password, not copied as-is.

Step-by-step migration process

  1. Back up the current site's files and database before changing anything.
  2. Set up the new hosting account with a PHP version that matches or exceeds what the site needs.
  3. Export the database from the current host, usually through phpMyAdmin or a command-line dump.
  4. Upload the wp-content folder and import the database into the new host's MySQL server.
  5. Update wp-config.php with the new database name, username, password and host.
  6. Run a search-replace if the domain is changing, so every stored reference to the old address points to the new one.
  7. Test on a temporary URL or by editing your computer's hosts file before changing public DNS.
  8. Resave permalinks under Settings, then Permalinks, to regenerate the rewrite rules on the new server.
  9. Point DNS to the new host once everything checks out.

Why a plain find-and-replace can break your site

WordPress stores some data, such as widget settings and some plugin options, as serialized PHP arrays. A serialized string includes its own length, written like s:19:"http://old-site.com". A simple text editor find-and-replace changes the text but not the stored length number, so the entry becomes corrupted and WordPress cannot read it back correctly. A tool that understands serialization fixes the length automatically.

# WP-CLI search-replace, run from the site's root folder
wp search-replace 'http://old-site.com' 'https://new-site.com' --all-tables

Migration plugins and tools

ToolWhat it does
DuplicatorPackages files and database into one archive plus an installer script
All-in-One WP MigrationExports a single file including a safe search-replace, imports it on the new site
UpdraftPlusBackup plugin with a paid migration add-on to move or clone a site
WP-CLICommand-line tool for exporting, importing and running search-replace directly

Common pitfalls after moving

  • 404 errors on every page except the homepage: resave permalinks to rebuild the rewrite rules.
  • Mixed content or certificate warnings: reissue the SSL certificate on the new server before forcing HTTPS.
  • Missing scheduled tasks: WordPress cron jobs set up through a plugin need to be recreated on the new host.
  • Email stops working: if email was hosted with the old provider, it needs a separate migration plan alongside the website.
  • Large imports time out: a database or upload size over the new host's limits may need a command-line import instead of the browser-based one.

Frequently asked questions

Can I migrate WordPress without a plugin?

Yes. You can export the database, copy the wp-content folder with SFTP, update wp-config.php, and run a search-replace with WP-CLI. A plugin is usually faster but not required.

Why does my site show the old domain after migration?

The database still contains references to the old address, often inside serialized data that a simple find-and-replace cannot fix safely. Run a proper search-replace with WP-CLI or a migration plugin instead.

Do I need to copy wp-config.php to the new host as-is?

No. The database credentials will be different on the new server, so wp-config.php should be edited or recreated with the new database name, username, password and host address.

How do I avoid downtime during a WordPress migration?

Set up and fully test the site on the new host before changing DNS, lower the DNS TTL in advance, and keep the old hosting account running until the DNS change has fully propagated.

What is WP-CLI search-replace and when do I need it?

It is a command that finds and replaces text across the WordPress database while correctly handling serialized data. You need it any time the site's domain or URL path changes during a migration.

Will migrating break my permalinks?

It can, since rewrite rules are generated from the new server's configuration. Go to Settings, then Permalinks, and click Save Changes on the new host to regenerate them.

Related topics