How are you?

Moving WordPress to a different domain

Your mileage may vary! Please create the necessary backups and test locally before doing anything on Production.

When researching how to migrate WordPress content to reyhan.org, I read the Changing Your Domain_Name and URLs section on the Moving WordPress Codex article but it wasn’t very clear.

Having mentioned this to John, he kindly pointed me in the right direction – here’s what I did:

  1. Install wp-cli on both the old and new WordPress instances (if you haven’t already1).
  2. On the old WordPress instance run wp db export (docs) to export the database as a .sql file (it’ll look something like old_site_wp_database-2018-04-09-bun3e8h.sql).
  3. Transfer aforementioned .sql file to a location on the server running the new WordPress instance.
  4. On the new WordPress instance run wp site empty (docs).
  5. On the new WordPress instance run wp db import /path/to/*.sql (docs).
  6. On the new WordPress instance run wp search-replace old.com new.com (docs).
  1. wp-cli is a really well-designed command-line tool, it made my return to WordPress a great experience.