Moving a WordPress site to a New Webhost

This article is a reference for me and anyone else who might find it useful. I have refrained from going into too much detail as that would add bloat to this article that would take away from its checklist nature. Instead, additional Googling will be required to learn how to perform each of the steps outlined here.

This article also applies to moving a WordPress site from the staging/dev/test site to the live/production site. Some webhosts offer free migration services, so you may want to check on that first.

#1 Make sure you have everything you will need

  • Registrar credentials. (This is probably goDaddy)
  • Hosting credentials or credit card info to setup a hosting account
  • If needed, create a 301 redirect table

#2 Save DNS info

This way you can revert any changes made if something goes wrong. A google search for DNS lookup will give you many online utilities that will fetch DNS info, or you can use the nslookup command.

#3 Put the website in maintenance mode

  • Put up a notice on the top of the website.
  • Install a WooCommerce catalog plugin to prevent purchases while migrating (or skip this step, and manually reconcile orders that may not get transitioned to the new db).
  • Install the ow-migrate plugin to prevent others from making changes on the backend.
  • Alternatively, put the db in read-only mode. see this Stack Overflow for more info, however, this requires super admin privelages, and is highly unlikely to work.

#4 Backup the DB, and restore it on the new webhost

Updraft and BackupBuddy are some of the more common tools for doing this.  If those don’t work, you can also perform a MySQL dump through either phpMyAdmin or on the command-line. You’ll need to make sure if there are any sub-sites (the-website.com/another-site), that you grab the databases for those sites as well. You’ll need to look-up the instructions on how to restore the backup depending on the method you used to backup the db.

#5 Point the old webhost to the new DB

Even though this will slow the website down a ton, we will temporarily use a database from the new datacenter. Fill in the wp-config.php file with the database name, username, and password. Then for the hostname, put in the external server. If that doesn’t work, (and it won’t work for Webfaction) put in 127.0.0.1:5555. Then SSH in and forward the database to port 5555 by issuing the command ssh -N -L 5555:127.0.0.1:3306 [email protected] -vv.

#6 Take the website out of maintenance mode

But leave the maintenance notice there until we’re done.

#7 Copy the files to the new webhost

This can be done by doing a backup and restore of the files only. Once again Updraft and BackupBuddy are some good tools. You can also do this manually by downloading all of the files. You’ll probably want to zip or tar the files first so it doesn’t take forever to download them. You’ll need to make sure if there are any sub-sites (the-website.com/another-site), that you grab the files for those as well.

#8 Change your hosts file

This makes your computer think the new website is live when it is not, allowing you to test things out and make sure the website was restored properly.

#9 Turn off debug mode if it was left on

This is done in the wp-config.php file.

 

#10 Install Google Analytics

Monster Insights is a good plugin for this.

#11 Allow search engines

Go to Settings > Reading > “Search engine visibility”, and make sure search engines are allowed to crawl the site.

#12 New websites may need the email field updated

Make sure the email field in general > email has been appropriately set.

 

#13 Handle SSL certificate

Sometimes you might be able to install the certificate before the site goes live. If you need to setup the SSL certificate yourself, sslforfree.com will give you a free certificates.  If the new webhost offers free SSL certificates, you may have to wait until after the site goes live before they will offer you one. In that case, deactivate anything that might be forcing the website to use SSL (force SSL plugins, security plugins, WooCommerce has an SSL setting for the checkout page, and also check the site and home URL in the general settings), and then after the site goes live and the change has propagated to the datacenter, then you can request an SSL certificate from the webhost, and then re-enable SSL forcing features on the website.

#14 QA

  • Make sure everything looks good
  • Test on mobile

#15 Change the A record

This is where we actually make the switch that tells the internet to load your website from your new host. Make sure the www version of the website works too.

#15b Changing the nameservers instead

This isn’t recommended as it can have unforeseen consequences. You’ll need to watch out for the following when doing this

  • Emails. You’ll need to update the email records to be the same as the previous nameserver.
  • Subdomains. You’ll need to make sure you either migrate the subdomains too, or you create the appropriate a records for each of the subdomains.
  • Other DNS records. Make sure you migrate any txt, spf, cname, and any other DNS records on the old nameserver.

#16 More QA

  • Disable old site
    • Disable the old site if it was using a different URL to make sure we are not loading assets or linking to pages on it.
  • Crawl for broken links
    • Using Xenu (Windows), Integrity (Mac), or Link Checker (All platforms) crawl the site for errors. You may find a lot of problems, fix any important ones.

#17 Create 301 redirects

You need to do this to make sure you don’t loose any SEO value your site has.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.