This month at work I started to migrate our sites to a new hosting provider. The process of moving the first site was really tedious since I had to remember back to the last time I did a migration, which was 2 years ago. It was also a frustrating process due to the fact that I have never been the one to make the choice on the provider and get everything set up before the migration.
So here are some of the things I either learned or had to re-learn during this process:
Understanding Trace Routes
I was trying to determine why our sites were slow when didn’t have high loads. So I took it upon myself to learn how to interpret trace routes. – It didn’t turn out to be as helpful as I was hoping, but now I know how to differentiate between a network issue or hosting issue.
How to Change Your Active Theme via the Database
In your options table, look for the
option_name‘s “template” and “stylesheet” and change those to the directory name of the theme you want to switch to. (This one was a re-learn.)
The WordPress Table Prefix is Used for More Than Just The Table Prefix
So I had moved the files and database for this WordPress site and I updated the
wp-config.php to use the correct database, password, and table prefix. The site looked fine, but I couldn’t login to any of the users. Luckily I had a friend that I was messaging about my issues and was able to figure it out. As I talked through the steps I had taken and looked through the options table, I noticed that a few of the
option_name‘s in there referenced the old prefix. I had tried just changing those to use the new prefix, but that wasn’t enough. So I ran a SQL search and there were a ton of references to the old prefix in the
usermeta table. I ran a search & replace on my SQL files and changed to
REPLACE INTO and uploaded. – It worked!
SQL Statement – REPLACE INTO
That part leads me to my next great discovery! –
REPLACE INTO. It follows the same syntax as
REPLACE INTO, so when you just need to replace some rows in the database, you can just change the
INSERTs from your export to
REPLACE before uploading. – Only really relevant if you’ve already started to set WP up at the new location and botched it or if you’re manually moving your
posts table over and want to replace the “Hello World!” post on the new setup. I ended up using it a decent amount for copying changes that happened with users during my transfer process. That way, email address changes, progress in our online courses, etc could just be updated.
Setting up DKIM & SPF Records
This one was another re-learned thing. I totally forgot to set up the DKIM/SPF records for Mandrill prior to changing Nameservers, so the next day I was wondering why the emails weren’t working!
Manually Installing an SSL
I’ve always purchased SSLs/SSL Renewals through my hosting provider and I used to just put in a ticket for them to install it for me. But since I apparently didn’t have enough on my plate, I decided I wanted to install the new one myself (and by getting away from the old provider, saved a TON)! The process actually went really smoothly and didn’t take nearly as long as I thought it would. A2 Hosting has a great walkthrough for it that helped!
Something I Learned But Didn’t Do Right
I needed to get the first site transferred quickly because it was going down frequently on the old host. We have multiple IP addresses, but once I got the first site moved, I jumped on the Nameserver change without thinking about the fact that the first site was put on the default IP. It didn’t seem like it mattered, because I figured I’d just put the next sites on different IPs. But it probably would’ve made more sense to have that site be on one of the add-on IPs, because now when I set up new cPanel accounts, they will automatically be put on the same IP as that site and I will need to switch them to another. (The first site is quite large and gets a decent amount of traffic, so I think it needs to be on its own.) – Basically, the default IP should’ve been the one that has smaller sites/future sites on it because I wouldn’t have to open as many tickets with the hosting provider to get the accounts assigned to different IPs.
What’s crazy is that I learned all of this stuff during one site migration. Plus, most of this stuff I learned just between January 9th and 11th! I’m really glad to be working for a company that trusts my ability to learn new things like this quickly and to be in a position where I can make decisions on the systems, tools, and services we use (or get rid of). I’m excited to be moving the rest of our sites now that I got past this initial phase of the process!