When maintaining a website, it is virtually inevitable that at some point you may need to change your hosting provider. There are many reasons why – cost, space, server performance, and support just to name a few. I recently went through this experience myself as I missed the ability to make remote connections to my database, a feature I had gotten familiar with on a previous package.

When you find a good host, the process of moving the website to the new host begins. The steps you need to take depend on many factors, like the type of website and email setup on the existing account. There are two main concerns during this time: data loss and downtime.

Prevent Data Loss By Fully Backing Up Your Website

If you are switching hosts, you are going to need to make a backup of your existing website. This includes more than just the files and folders that make up your site’s design and structure.

This can include a database of the content which your website will need to so it can be set up again. You will need to take note of your database configuration, like your username, password, and localhost, so you can easily set these up and connect your website to its database.

WordPress users will need to edit the wp-config.php file and look for the following lines to edit:

define('DB_NAME', 'db_name');
define('DB_USER', 'db_user');
define('DB_PASSWORD', 'db_pass');

Email is another thing that will need to be backed up. When backing up emails, the process will be different for IMAP or POP emails and third-party exchange providers, like Office365. For POP and IMAP users this is done by backing up the mail directory on the root of the server. Users of third-party providers may need to pay attention to their DNS settings as these will be required by the new host. Keeping a copy of your files and a note of relevant settings will help you be confident in the process.

Using CloudFlare is great for keeping all your email and DNS settings away from your host, this makes migrating domains a lot easier (also CloudFlare offers free SSL certificates for all accounts).

What To Do When You Are Missing Data

One of the worst things that can go wrong when switching to a new host is the loss of data, be it files, databases, or emails. Routine backups of data is not a standard feature from web hosts, but your files will continue to exist on your old host until you cancel your hosting plan. I tend not to tell my host I have switched until it is fully working on the new host in case they switch my account off early.

Waybackmachine.com can also be a handy resource for retrieving content from old lost websites. Wayback machine is a non-profit archive of the internet that takes snapshots of all websites and stores them so they can be retrieved. Its archive allows you to capture, manage, and search collections of digital content.

Reduce Downtime: Keeping Your Site Live During The Switch

A hosting switch done well should result in a seamless transition with your website visitors being completely unaware you are in the middle of this process. For this reason, it is a good idea to adjust the DNS settings of your website before you go live. This will need to be changed with the domain registrar or control panel.

This process is not instant and relies on a process called propagation. This is the term used for how the internet updates itself. ISPs need to be notified which server to load from when the request is made from the IP address linked to your site.

This can be frustrating and may lead to hasty decisions to set everything back to your old host and start the process again, mistakenly thinking something has gone wrong. From my past experiences, I have found simply waiting often resolves the problem. Patience is a virtue during propagation.

What To Do If It All Goes Wrong

Unfortunately, things can go wrong during this process, and you may find you are unable to see your website during the phase of propagation. You may even find that your website is continuously bouncing between the old and new hosts. This is normal for up to 24 hours but anything longer may indicate incorrect settings.

There are a few steps you can take in this scenario to isolate the cause and work out a fix:

  • Ping the domain to find out what IP address it is pointing to and see if it matches your new host or the old host. To do this, open a terminal/command prompt and type ‘ping domain.com’ replacing domain.com with your actual domain without the HTTP part.
  • Make use of the website MX Toolbox mxtoolbox.com to find out information about a domain like its DNS and MX records.
  • Domain tools will allow you to tool up a domain and find where it is pointed to and run a trace route to get to the domain. This can show you the IP address, and nameservers that have been misconfigured.

David Carr

For the past 10 years, I've been developing applications for the web using mostly PHP. I do this for a living and love what I do as every day there is something new and exciting to learn. In my spare time, the web development community is a big part of my life. Whether teaching code to kids at a local school, managing online programming groups and blogs or attending a conference, I find keeping involved helps me stay up to date. This is also my chance to give back to the community that helped me get started, a place I am proud to be part of. Besides programming I love spending time with friends and family and can often be found together going out catching the latest movie, staying in playing games on the sofa or planning a trip to someplace we've never been before.