Moving From Server to Server: A Guide to Switching Hosts

One day you’ll outgrow your $5 a month shared hosting account and need more resources to cope with all the Digg front page stories and StumbleUpon successes in addition to your large amount of search engine traffic. Or maybe your site is still fine with budget shared hosting, but the host you’re currently on has been getting on your nerves (e.g. billing you too much, having excessive downtime).

Whatever your reason, you may have to move to a different server sometime. It can be a whole day’s work, and if you’re not careful you could lose data or have your site go offline for a few days.

Here are the basic steps to move to a new server:

  1. Put your site into maintenance mode, so people don’t go around adding comments to your blog or otherwise changing database tables while you work.
  2. Backup your entire website. Get every file, every database table, and note settings from your control panel.
  3. Order your new hosting plan, and wait for it to be set up.
  4. Once you have the new hosting space, go through the control panel options and set them to whatever your site requires.
  5. Upload your files, and import your databases.
  6. Go through files and set database access information to the new server’s values. Also, if you use absolute paths (e.g. /home/user/www/index.php) on your site, you may have to update them if the servers are configured differently.
  7. Update your domain’s DNS settings to point to the new server. If all goes well, your domain will start pointing to the new server somewhere along the line, and your visitors will seamlessly start going to the new server. Use DNS Pinger so you know when the update is complete, so you can make sure nothing went wrong once the DNS updates.
  8. Address anything that goes wrong. Believe me, there’s a 90% chance that you’ll overlook something unique to your case that needed to be addressed during the move.
  9. Don’t cancel your old hosting account for at least a month, in case you need to refer to something there.
  • http://blog.fcon21.biz John W. Furst

    Yeah, it’s easy to oversee little details.In some cases you will use the opportunity to upgrade your software at the same time. E.g. newer WordPress release, your new hosting account might use PHP5 instead of PHP4, or probably another database version or software, different security settings, etc.All this will cause additional trouble, especially, if you have customized plugins, templates, settings yourself. Things might not work from scratch as smoothly as you like. I guess people who tuck into code, know what to do anyway.Those non technical people with their Fantastico default settings might not get into those troubles, but an upgrade will break something (usually).I would put the site in maintenance mode later, after an ‘empty’ test installation of the site (blog, gallery, dynamic elements, …) performs well on the technical level.Then grab the content, move it over, do the last tweaks and switch.YoursJohn

  • http://omninoggin.com Thaya Kareeson

    Matt,you wrote this just in time.  I was planning on changing server providers over this weekend.  About your post, I have a couple of questions. 1. Shouldn’t you order your hosting plan before anything? Usually it takes the provider a while to set it up, so you can spend that time preparing the migration. 2. How do you put your site in maintenance mode and notify the readers? 3. Shouldn’t you set your server to maintenance mode just right before the data migration? Aside from those questions, I wanted to mention that I wrote a guide on how to create a staging WordPress site for testing that contains some useful commands (particularly MySQL and rsync) that non-technical people can refer to when doing server migration. (http://omninoggin.com/2008/04/.....r-testing/) Hopefully it will help someone out. In fact, maybe I will post a command-by-command guide when I migrate servers this weekend? :-)

  • http://www.webmaster-source.com Matt

    @John, Yeah, that would work good. I’ve sort of done that myself before, but it depends on the situation. (Oh, and I’ve had to migrate some of my custom code from PHP4 to PHP5 before, and it wasn’t exactly fun. Took a couple hours to fix and test everything…)

    @Thaya, I guess it would make sense to order the hosting first… Putting a site into maintenance mode varies. If you’re using WordPress, you can use the useful Maintenance Mode plugin. If you’re not using WP, you’ll probably have to hack together your own solution. One method I’ve used before is to create a page with a “Down for Maintenance” message, and edit my pageheader.php template, adding a header(“Location: maintenance.php”); to the top. Basically the line redirects all traffic to the site to the maintenance page.

  • http://omninoggin.com Thaya Kareeson

    @Matt,Thank you for your response.  I love how there is a plugin to do just about anything in WordPress.  I’m be looking forward to the geek stuff I’ll be doing this weekend.

  • Pingback: Completed OMNINOGGIN Server Migration | OMNINOGGIN

  • http://www.blogcreativity.com Sumesh

    There’s one more thing: ask your original host to setup a TTL (time to live) of 5-15 minutes, wait for a few minutes, and only then switch nameservers. That way, the DNS propogation will be done in less than half an hour. I did this for my last host move.

  • http://www.webmasters-forum.org Raman

    nice tips,will definitely look for each and every details provided….thanks

  • Tanner

    On last thing make sure your new host has good support and weekend hours. Nothing worse than calling at 3 am to fix somthing small and getting a 5 dollar guy to submit a ticket. When I moved to Server Intellect I had these guys on the phone around 20 times and they answered and fixed everything little issue I had. Support good support!

  • http://www.strictlyonlinebiz.com/blog/ Udegbunam Chukwudi

    I installed your amazing gocode plug-in yesterday and that’s how I found your blog. Nice articles you’ve got here. You might want to consider linking to http://www.webmaster-source.co.....-htaccess/ in step 1 of this post. Good for SEO via internal linking. ;)
    I’ll be staying subscribed to your feed for updates.
    Cheers.

    • http://intensedebate.com/people/redwall_hp redwall_hp

      Thanks for the suggestion, I'll add the link. And enjoy the plugin. :)