How to move your website

Okay, so you have a website. But somewhere along the line, you’ve realised you need to change your hosting vendor. It could be any number of a million reasons: Your company got really successful and your old vendor can’t handle the load, your old vendor closed down, your old vendor is a shady bastard and you don’t trust them anymore, and so forth.

So here’s the scary part: How do you move your website without the fear of losing business? It’s not overly complicated, but unlike launching your website for the first time, moving your website has a number of dependencies, and you should do certain things in a certain order.

It’s not too hard, but you need to be patient. And careful…

There’s a couple of things we need to define to make sure we’re all talking about the same thing. Thankfully, I did that in my previous post, so go have a quick read before we go any further.

When it really comes down to it, the single biggest thing you’re doing is changing the location of your website from your old hosting vendor to your new hosting vendor. That means updating your registrar information, and copying your website. But it takes more than just two steps. In fact, you’ll have to do some things more than once.

  1. Change the Time To Live (TTL) with your registrar.The TTL is a number, usually listed in seconds (26,400 or greater), that defines how long a DNS server will “remember” your website’s address. Think of it as writing down a phone number in disappearing ink. Sooner or later, you’ll have to go back to the phonebook to write it down again.

    Why have such a system? Why not always refer to the phonebook? Because it’s expensive. Imagine having to always call the operator to get a phone number you want to dial. Now imagine that everyone making phone calls has to call the same operator every single time. You can imagine how slow that would get after a while. This is the same shtick, only with computers.

    In this case, you’re temporarily changing the TTL value to something really, really low.  Like, say, 5 seconds. That way, the ink disappears almost immediately, and computers always end up going back to the phonebook before calling your website. Again, it’s temporary, so don’t worry.

    You should do this step at least 24 hours before you plan to publicly move your website. This should give enough time for this change to take effect world-wide. (It’s a DNS thing. Just trust me on this.)

  2. Copy your website to your new hosting vendor.This should include every single thing you need to replicate your current website, including any and all live databases. You’ll want an exact copy, because you’ll want to test and make sure everything’s perfect before you move forward.
  3. Configure your environment (especially if you’re moving to load-balanced servers) to make sure it behaves properly.
  4. Spoof your computer to see the new hosting vendor.”Spoof” is geek for “make your computer see something different”. This might be the trickiest part, as you might not have the ability to do this yourself. (You might need your systems administrator to help you.)

    Open your hosts file. Every computer has one.

    In Windows, it’s usually C:\Windows\System32\drivers\etc\hosts
    In OS X and UNIX, it’s usually /etc/hosts

    In either case, these are text files that have no extension. Inside, you’ll see a lot of stuff that generally makes little to no sense to a human. This is fine, since this isn’t about you anyway — it’s about your computer.

    You need to add one line, which will look something like this:

    123.45.67.89    www.mywebsite.com

    You’ll get the number from your new hosting provider (they’ll usually provide it to you), which is the address (“phone number”) for your new website. All you’re doing is telling your computer to ignore the regular phonebook and use your number instead.

  5. Check your website.Because of what you did in the previous step, you’ll now see your new hosting vendor at the same URL (e.g. www.mywebsite.com). It should be also be noted that because of what you did in the previous step, you can’t see your old hosting vendor. This is only temporary.

    Basically, you’re going to test the crap out of your new hosting environment. Make sure everything is working, your data is being saved properly, your ecommerce system still works (e.g. you’re still going to make money), images are coming up properly, and you’re seeing (basically) exactly the same site you saw before.

  6. Prepare for the switch.You’ve allowed for 24 hours since you changed the TTL. You’ve copied and verified that your website is correct. Now you’ve reached the critical point: making the final move.

    If you have data that is constantly being updated (e.g. an ecommerce system), you’ll need to take one more step before you move. You need to put up a “closed for updates” sign on your door, so people know that your website is going down for a few minutes (and hopefully, that’s all it will be). You need to make sure that the data transactions stop, and you can (reliably) move all your data in one shot without fear of losing anything.

    Yes, you might lose a couple of people in the process, but that shouldn’t hold you back.  (Yes, there are ways of dealing with LARGE multi-million dollar commerce sites in a near-zero downtime manner. Those guys also have entire departments of people to manage these situations.)

  7. Update your registrar’s information.Log back into your registrar, and change the address of your domain (this should be the same as the number you put in your hosts file). DO NOT change your TTL. Not yet.
  8. Wait.Okay, this is the hard part. You’ve changed the information. In theory — and I stress that it’s theory — the TTL should allow near-instant updates and you should see traffic right away. However, it’s been known to happen that sometimes it takes a while for the traffic to actually switch. Don’t panic if you don’t see traffic on your new server right away. It’ll come.
  9. Be prepared to change back.Here’s the sad reality: things might not work. Something could still go wrong. (Hey, it happens.) This is why you didn’t update the TTL. If something goes wrong, just go back to your registrar and change the address back to the old one. You know your old hosting vendor is fine, and it’s helpful to have it, just in case.
  10. Cut the cords.Once your switch is made, and your system is running, you can then move to the next step: cancelling your old hosting vendor’s contract. But do yourself a favour — wait a week, just to be sure. Then you can log into your registrar and change the TTL back to something like 26,400 (about 24 hours), or more. Don’t forget that step!

Leave a Reply

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