Switching to a new hosting account can sometimes be a daunting process. But if you are following these steps then, I can ensure that your website migration will be smooth and safe.
How to Switch Hosting Without Suffering Downtime
Buy the new web hosting plan first, and make sure you don’t cancel the previous one before the switching of website is complete (most crucial thing to keep in mind)
Also, do not tell your previous web hosting provider about that you are about to switch hosting, since no company would let their customer go, and probably they can cause hinderance to your migration process.
Now you will have two web hosting accounts both of them with different hosting provider at a time (i.e. your current host and the hosting you want to switch your website to)
Now the importance of this step lies in the fact that you must “keep the file structure same” as that was before in the previous hosting.
You can either use FTP client like Filezilla to download all the files with the same file structure first in your local machine (computer) and then connecting your computer to the newly bought hosting account and uploading the same file structure in there.
Or if you are using cpanel in both the hosts then you can take complete Home Directory backup from the backup wizard in your cpanel and you can directly upload this file into your cpanel of the new hosting account through the backup and restore option.
Sometimes the bandwidth of your hosting account doesn’t allows you to take the home directory backup (when the file size is large) in that case you can go to the file manager through the cpanel of your previous host and select the public_html folder and click on compress button from the top menu in the file manager.
Choose the Gzip Tar. compression and download this compressed folder from the previous host and upload to the file manager of new hosting, and decompress it there and replace the default public_html folder with the one you just extracted.
Download the database from the previous host and upload it to the new one from the backup and restore option in cpanel in both the hosting accounts. This can also be done via SSH or cPanel’s phpMyAdmin.
Take the backup of your data because sometimes files get corrupted during this whole migration process and could lead to reuining up your hard work.
While emails do not normally transfer, still you can archive your emails from the old host. You can do this by making a POP3 connection to each email address; this way all the old emails are downloaded to your local computer. The new host will not have those old emails, but the new host will be able to fetch new emails.
Now when you have a copy of your complete website on both the webhosting accounts, it is the right time to change your domain name’s DNS in the domain name provider’s control panel.
You may need to contact the new host to find out what DNS settings you will use for your domain name.
DNS name servers usually looks like this (replace “yourhostname.com” with your host’s actual domain name):
After making the DNS changes or I can say after changing the nameservers of the domain name to the new host’s you should wait for atleast 48-72 hours which is advised by the hosting providers, since DNS changes takes this much time to completely start fetching the files from the new hosting server.
During this 48-72 hour waiting period, your DNS will be propagating worldwide and your site will be randomly loaded from either the old host or the new host. After completion of this period, DNS cache will be refreshed properly and your website will start loading the files from the new hosting server.
You can now contact your old hosting provider and cancel your previous hosting account, because they are not required anymore. If you originally bought your domain name from the old host, kindly do not cancel your domain registration.
If you have successfully completed all the aforementioned steps then congrats.. your website is now successfully migrated and that too without suffering any downtime at all!.