Table of Contents
This is … crazy simple. I wanted to move a site from ipstenu.org to ipstenu.com (yes, I own that too). While ipstenu.org is a Multisite network, ipstenu.com is where I put a ton of add-on domains. I was moving a site over and, as it was WordPress, did it in a matter of minutes.
Add the domain to the … domain Add the domain to the … domain
Since I don’t care to have multiple hosting accounts, and I’m the only one with SSH/FTP access, it’s safe enough for me to do this. There is a risk when you share multiple domains in one hosting account, that if one gets hacked they’re all vulnerable, but I consider it low in my situation. Every plugin is vetted, every file is checked, and then I went and gave each add-on it’s own FTP account. Neurotic? Thy name is me.
Anyway, I add the new domain to my hosting where I want it.
Create the new DB Create the new DB
I have to make a new database, and generally a new DB user, on the server too.
On existing hosting, I do this:
wp db export
That gives me my SQL file, thanks to WP-CLI. It’ll be named
example_com.sql and will sit in my folder with .htaccess and everything else.
I do it via SSH. I go to the new location and run this:
scp -r email@example.com:path/to/files/ .
Since I have ssh keys set up, it’s easy. If I don’t, I’ll put in the password, but that’s straightforward.
Edit wp-config.php Edit wp-config.php
Now I have to point to the new DB. Sometimes I name it the same, but usually I don’t, so I’ll edit the DB name, DB user, and password.
Import the old DB Import the old DB
wp db import example_com.sql
Boom. It’s all dumped in! Only two steps left!
Search & Replace Search & Replace
I love this one.
wp search-replace example.com newexample.com --dry-run
I ALWAYS dryrun test it. This is a serialization safe search, so rarely is it ever going to be an issue to just run, but it lets me make sure I don’t get any wonky results. I never have, so re-run without dry-run.
Delete the SQL file, delete the old files on the old server.
I moved code. That’s shipping, right? Or is it margaritas are for migrations?