Migrating WordPress Sites
Migrating WordPress Sites
After more than five years of using the same hosting company without having any big issues, I’ve noticed a decline in the service over the last couple of months. I’ve been experiencing quite a bit of inconsistent uptime and sluggish server response. I’m on my site up to four days a week at random times updating code, adding/changing functionality or writing blogposts, so seeing the recent performance issues has been pretty easy. I realize that I still need to do quite a bit of site optimization on my end, but when I run speed tests the problem starts with the HTTPRequest, which tells me that it’s not the site, more like the server not responding. In addition, my database performance has been very slow (even after optimizing) and has even been completely down for extended periods of time.
I know this is to be expected because the site is on a shared server, but the sporadic downtime seems to be more often than is acceptable to my own standards, especially for the price I’m paying monthly. So based on a solid recommendation from a friend, I’ve found a new host and plan on migrating my site later this week. I did some research beforehand and made a checklist to help ease the migration. I’m sharing my checklist for migrating WordPress sites because it might be helpful to anyone that’s doing the same now or in the future.
Checklist for Migrating WordPress Sites
- Find a better web host!
- Okay, this is the biggest step… Back-up all the necessary WordPress files from your current host.
- You should have been automating regular back-ups of your db (database) and wp-content directory, but if you haven’t (tsk–tsk), Wordpress has an export (back-up) feature. It’s important to note that this export feature does not back-up attachment files. So you’ll have to manually grab those files from your server via FTP (File Transfer Protocol).
- Also, export the database manually from your phpMyAdmin
as a back-up to the back-up. Be sure to select all of the database tables before exporting!
- Upload the files and import the db to the server on your new host. Make sure that your wp-config.php file has the correct login info so that WordPress can find and access the database.
- UPDATE: I ended up not even using the exported XML from the WordPress back-up tool (mentioned above in Step 2) and instead:
- Transferred all of my files from the old host to the new host via FTP.
- Created a new database through my new host’s phpMyAdmin.
- Imported the SQL file (refer to Step 2) into the newly created database.
- Updated the wp-config.php with the new database name, username and password (as stated in Step 3).
Providing you keep everything in the same structure, this will work perfectly.
- Don’t forget to transfer any additional un-related WP files to your new server via FTP. You can also take this time to do some house cleaning!
- UPDATE: Before you are able to test the server on your new host as I state in the next step, you will need to update your hosts file to map yourdomain.com to your new host’s IP address. Because of WordPress’ security and dynamic nature, the site will appear “broken” or you might see various security errors if you don’t map your site’s URL to the new IP. This won’t be the case for non-dynamic files or sites. Here’s a good link to follow along with if you’ve never re-mapped a URL to a different IP address in your hosts file. Once the new host propagates, you can then delete that mapping as it’s only purpose was for proper testing before switching the DNS.
- Check that everything is working properly on your site on the new server. You can preview your site on its new host by using the temporary IP address. Keep in mind, if you don’t use relative address linking (e.g. “../example.html”) that the hard-links (e.g. “http://yoursite.com/example.html”) might break or take you to the old site when testing on the temporary IP address.
- Re-check everything on the new host again!
- Setup all of the email accounts needed for your domain in advance on the new host. They won’t work right now, but it’s good to ensure that once the transfer propagates, that will already be taken care of.
- I like to forward my emails to my gmail account to help prevent losing emails between the transfer.
- If that isn’t an option and you have to worry about more emails than just your own, you can create two new email addresses on the new host per email address. Creating individual accounts that check both mail servers is an ironclad way of making sure you don’t miss any emails during the propagation period. Keep in mind this is only temporary for that 24-48 hour period.
- My site is basic, but make sure you setup any additional applications or services you might need on the new server in advance. (e.g. security certificates, SSL, shopping carts, custom components, etc.)
- Re-check everything… yes, one last time!
- Notifying your users of the upcoming change is a good idea. Especially if you offer services or products. They will be more tolerant of any issues that may happen while on your site if they’re expecting it.
- Once you’re sure that everything looks good, switch the DNS (Domain Name Servers) of your URL to the new host’s nameservers.
- Allow the DNS change to propagate across the servers. You should receive some emails confirming the changes. It typically takes 24-48 hours for the entire world to see the changes. This is called propagation. In this time, some users might see your site on the new server or the old server depending on their location.
- After propagation is complete, inform your old hosting company that you are canceling their hosting services.
- Pat yourself on the back for a job well done, you’ve just migrated a full website to a new server. That’s pretty cool!
Many hosting companies offer domain transferring as a free courtesy service for joining, but I prefer to handle this myself. Why? Because doing it yourself ensures that nothing is overlooked or that the domain name doesn’t switch before your site gets propagated to the new server. Besides, where’s the fun in having someone else do it for you? Learning sounds so much better! This is one of those things that’s good to add to your tool belt for yourself or your clients. The choice is yours, it all depends on your own knowledge and comfort level.
I hope this checklist for migrating WordPress sites was helpful and useful. If you have any additional concerns, questions or anything to add to the checklist, please comment below!