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:
- Install wp-cli on both the old and new WordPress instances (if you haven’t already1).
- On the old WordPress instance run
wp db export
(docs) to export the database as a.sql
file (it’ll look something likeold_site_wp_database-2018-04-09-bun3e8h.sql
). - Transfer aforementioned
.sql
file to a location on the server running the new WordPress instance. - On the new WordPress instance run
wp site empty
(docs). - On the new WordPress instance run
wp db import /path/to/*.sql
(docs). - On the new WordPress instance run
wp search-replace old.com new.com
(docs).
-
wp-cli
is a really well-designed command-line tool, it made my return to WordPress a great experience. ↩