You want to move your site to new hosting without downtime? You want to test your site before update or upgrade to new version without error on current site? In this tutorial, Bien Thuy will guide you how to Switch Hosts Without any Downtime . Let’s say you have 2 hosting accounts. Host A is current hosted your yourdomain.tld site and IP address is 18.104.22.168. Host B is new hosting and you want to move yourdomain.tld to and IP address is 22.214.171.124.
Now, Bien Thuy will guide you moving your site to new hosting without downtime. And in other case, for testing purpose, that mean you want to test site before you update or upgrade or do anything without take down or make error on current site, you can do the same way.Let’s start!
Make a full backup of current site.
Download your full backup to your computer.
Change hosts file on your computer. For Windows users, please read How to edit hosts file on Windows. For MAC users, click How to edit hosts file on MAC. Enter IP address is Host B’s IP address. and domain is yourdomain.tld. For example, see picture below. I will testing bienthuy.com on new server with IP address is 126.96.36.199 (<– host B).
After you change your hosts file, Clear DNS on your computer, or some case, you have to restart your computer. And then, open web browser then type yourdomain.tld to see if it show contents on your new server or not. If it show contents on your new server, move to Step 4.
Login to your new host and make sure new host setting yourdomain.tld is hosted domain. You can add yourdomain.tld on new host as addon or main domain. Use your new hosting (Host B) account and login, create new database information (if needed), upload your backup code to new host, reconfig database information in your config file (if needed) – for example Joomla code is configuration.php file, wordpress is wp-config.php file …
Make sure all setting is correct and run yourdomain.tld. If you set up it correct, it will show you the same site as on old host. Now you can edit, update, upgrade or doing anything to yourdomain.tld. Any change now, only you see. All other computer access yourdomain.tld still see contents on your old hosting (Host A).
After you’ve done edit, update or upgrade your site on new host (host B), and you sure it’s running without any error, you are satisfied with your changes, it’s time to edit your hosts file again, now just undo what you’ve edited (remove the line you insert – for example in my case is remove 188.8.131.52 – bienthuy.com) from hosts file. Save hosts file and clear DNS cache. Run yourdomain.tld on your web browser again to see if it’s back to old host contents or not. If it is, go to step 7
Go to your domain control panel and change your dns to new hosting dns server or point yourdomain.tld to your new hosting IP.
That’s it. The process of switch hosts without downtime done. If your site is a dynamic content with comments, forums or anything related to visitors, just close your site on old host before changing DNS. So, after changing DNS, you will know when your site is working on new host. If it’s still show close site, that’s mean old host. If it show your normal site, that’s mean it is running on new host.