How to switch web hosts, fast
Lately I’ve been working with several clients who are looking forward to big media days—national coverage on TV shows and websites who share their respective target audiences. Knowing these opportunities are coming, they’ve asked me to make their sites as solid as possible in case the coverage turns into real click-throughs.
There are many things that can be done to help in this situation, but today I want to talk to you about our Plan B—what to do if everything goes wrong and the host can’t handle the traffic. All of the clients in question are using budget hosts and don’t want to pay for premium hosting unless it’s absolutely unavoidable—but they don’t want their sites to go down, either.
There are high-end solutions to this problem, but typically they’ve been both expensive and complicated. Fortunately, there’s a now simple set of preemptive measures that give us the affordability of budget hosting and the ability to hightail it, fast, if need be.
Before the traffic hits
The great thing about this plan is that there are only two things you need to take care of before the traffic hits (and you should be doing at least one of them anyway!). Obviously you should also do what you can to improve site performance so that it’s less likely to go down in the first place, but all you need to do for your backup plan is this:
- Have backups
- Use CloudFlare
You should already be making regular, automated backups, but if you needed a reason (you know, beyond hackers and hardware failures), this is it. Make sure you’re backup up the database and all the files you can’t easily replace (like your media uploads and theme files), plus your wp-config.php file (if you’re using WordPress).
The second point, using CloudFlare, may help your site stay up in the first place (it reduces the stress on your site by serving some of the files for you, and by keeping most folks with bad intentions away). But if your site goes down, CloudFlare is the key to being able to quickly move to another host.
A crash-course in “DNS as it applies to your website”
Your domain name is basically a catchy, easy way to refer to the place where your site is hosted. Think of it as the equivalent of a street address; it’s easy to tell someone and gets them to the right place. But where your site is actually hosted is more accurately referred to by a series of dots and numbers, called an IP address. Think of this as the equivalent of GPS coordinates. Yes, you could tell someone you live at 45°31′12″N 122°40′55″W, but it’s so much easier to say “123 Dimmick” or whatever.
In order to keep track of which domain name goes to which IP address, there are servers called name servers that have all the info web browsers need to get to the right place. Behind the scenes, when someone types in “wpmoxie.com,” a lookup happens that finds out that the relevant name servers, and then asks them where to find the website represented by “wpmoxie.com.” Each name server typically only keeps track of the sites hosted by the host running the name server.
An important fact: the records that point to the relevant name servers are not updated continuously. Your internet service provider (and all internet service providers around the world) only grab a new copy of this information on a scheduled basis, because otherwise it would be overwhelming and impossible to stay on top of. Most ISPs get a new copy of this information somewhere between “every two hours” and “every two days.” Once most ISPs have the current information, your change is said to have “propagated.”
Here’s the reason this all matters to you: if you switch hosts, you (usually) have to switch name servers. But when you switch name servers, that means that a good chunk of your visitors will continue going to the old host (because they can’t help it) for hours or even days after you make the change.
How CloudFlare saves our bacon
As part of the process of setting up CloudFlare, you change your name servers to their servers. This initial change takes the standard amount of time to propagate, but after that, your name servers will stay the same (they’ll be CloudFlare’s) even if you change hosts. Instead of changing name servers, you’ll just change a couple of settings with CloudFlare, and the changes will take effect for almost all visitors, almost instantly.
The nitty-gritty: how to change hosts
- Get the new host set up. If you want to be really prepared, you should have your backup account all ready to go. But if you’re really watching the budget, you can keep your backups ready, and sign up for the new account as soon as you know there’s a problem, and then upload as quickly as you can. (If you’re going this route, you’ll want to make sure you know what the signup process is at the new host—some hosts do manual account verifications, and that could unacceptably delay the process.) The setup process is the same as for any site move; you upload the files, create the database and database user, import the database, and update the config file. (If that sounds like greek to you, you should probably have a pro on call.)
- Make the changes within CloudFlare. I made an off-the-cuff video showing you how:
- Make sure anything extra services (like email) are also transferred, if needed. The last thing you want is to stop getting your email at a critical time!
What if you don’t have any warning?
It’s great if you know it’s coming, but what if the traffic is unexpected (or you just turn out to have an unreliable host)? Well, for those potential reasons, I recommend backups + CloudFlare to everyone. The beauty of this setup is that you don’t have to know it’s coming: if you have backups and are using CloudFlare, you can make the change just as quickly.