articles

Home / DeveloperSection / Articles / Guide to Website Migration No Downtime

Guide to Website Migration No Downtime

Guide to Website Migration No Downtime

Arman Khan712 05-Oct-2019

We've compiled this guide to list out the steps you can take to ensure a downtime free web hosting provider switch for your website.

Are you confused or uncertain about how to switch your WordPress website from your current web host to another with no downtime in between? We totally understand, just like changing physical houses, moving into a new home (web hosting plan/provider) on the web comes with its own challenges. A major challenge is site downtime during the duration of the move.

Step 1: Complete The Move First Before Cancelling Out The Old Plan

This is very essential, do not cancel your current web hosting plan account before completing the move. This is a common mistake that website admins who are unfamiliar with the web hosting terrain make. Especially when switching out web hosting providers, they inform their old web host about the planned move to a new provider's service before they actually embark on the move.

Even though it is good practice to let your current web host know about a move, doing so before completing the move would cause site downtime and in most instances total loss of data and files immediately a cancellation request is processed.

STEP 2: Make Copies Of Your Website's Databases And Files

Having an exact copy of the layout, design files and database on your website is a good way to make web hosting changes without alarming your site's visitors. You should pay special attention to the structure of your directory when copying your website's files. Do not make changes to the structure of the folders on your current hosting account, no matter what. Make copies of these files just as-is and upload them to your new webserver without making modifications.

Changing filenames or moving things around can break internal links and in extreme circumstances disrupt your content management system.

STEP 3: To Prevent Downtime, Change The Host File

When you are done uploading files to your new web hosting provider's serves, you will need to change the host file. You can do this by accessing the installer.php file using a browser's search bar. Typically, you will be able to access this file using a URL

In this instance, this type of URL will show a 404 error and redirect you to your old web hosting account. This is as a result of your domain name still being directed at your old web host.

A lot of tutorials would suggest that you fix this by changing your domain name server position by redirecting it to your new web hosting providers servers - that would be wrong. Doing this would make your website appear broken to its visitors. To access your site on the new platform temporarily, without making changes to your old sites, go through the host file on your PC.

This file can be used to redirect your domain name to a particular IP address - that is, trick the computer into reading the website as moved when it is not. To add an entry in the host's file for your domain name that points at your new web hosting firm, you will need to make a couple of changes. This essentially is to provide you access to files on the new server hosting your domain name, even though your site's visitors will be accessing your web pages from the old web host (This way, your website remains online while you complete the move).

Here's how to do this:

● Locate your new web host servers IP address. You can find it by logging into your cPanel dashboard and clicking on 'expand stats links' on the left-hand sidebar. The IP address should be listed under shared IP addresses. In some instances, you would find it listed under account information.

● If you are a Windows user, go to programs-all programs-accessories, click on notepad and set to run as administrator. You will get a Windows UAC prompt, click on this to activate notepad with admin rights. In notepad, go to file -open and locates the C:\Windows\system 32\drivers\... folder, select files from this folder and open it.

● If you are a Mac user, you need to enter this command to edit host file in an open terminal output.

sudo nano /private/etc/hosts

● Mac and Windows users alike would need to enter their IP addresses at the bottom of the host files alongside the domain name. It should be done like this:

192.168.1.22 www.yoursites.com

Remember to switch up the current IP address with the one copied from cPanel along with your site's and your domain name. Now that you've completed all that, you can now view your file on the new web host platform with your domain name in your browser.

Don't forget to undo the changes made to host files after the migration is completed.

STEP 4: Move Email Accounts, Databases And Files

Moving a static website to a new web hosting plan is pretty simple. All you have to do is download everything (that is, move files, html, jpeg and so on) from the old web host account and upload them to the new one - following the exact file and folder structure. Moving a dynamic website, especially one with a large database, would require a little more work and finessing to switch out hosting plans.

In order to move a dynamic site that runs on database (MySQL), you would need to export the database from the old platform and import into the new platform. CPanel users can do this easily by using PHPmyadmin.

If you use a content management system, like Joomla or WordPress, you would have to reinstall the content management system on the new web host platform before the database can be imported. Some web hosting providers have easy transfer functionality (WordPress exports/imports feature) which can be used to transfer data files directly onto the new CMS platform.

If your WordPress site is on cPanel, you can move the files and database to your website to a ZIP folder and then put it in your www. or public_HTML folder --- upload to the new web hosting platform and include the following lines into your WordPress configuration:

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']); define('WP_HOME', WP_SITEURL);

STEP 5: Update Domain Name Servers

At this point, you need to update your domain name server to that of your new web hosting provider. It should show up on cPanel Dashboard or your web host's database. Because your website is on, your site visitors will be able to access it while the changes occur.

If you use a domain registrar like Go.daddy or domains4less , you can set your domain name server by locating your new web hosting provider's name servers and updating them following the instructions on the platform. This can also be done if you registered your domain name with your old hosting provider, just look for it under the tab that lists out your domain names.

There may be some slight differences depending on the platform but the basics stay the same. Locate existing domain, and look for update option to change the name servers.

STEP 6: Cancel Your Old Hosting Plan

Once you are done with step five above, wait for 24 - 48 hours to ensure that your updated DNS is functional and running. You can then contact your old web hosting provider to cancel out your plan with them. If your domain name is bought with the old host, do not cancel your domain registration. Follow all the steps listed above and you would have switched out your web host with no downtime!

In Conclusion

Although switching out web hosting providers can be scary, the steps outlined above would help you successfully manage these transitions as easily and quickly as possible. So you do not have to stick with an old service that you have outgrown because of the hassle of switching hosting providers.

Just remember to carefully plan the move, understand the process, ask for help when needed and take your time.


Updated 16-Nov-2019
Contributor

Leave Comment

Comments

Liked By