Hosting Migration Guide: How to Switch From One Web Host to Another

Article written by:
  • Hosting Guides
  • Updated: Nov 15, 2018

In an ideal world, we would never have to worry about switching web hosts – our site would remain happily housed at the current hosting provider’s facility with great load times, affordable costs, and 100% uptime.

Unfortunately, the world is not ideal and this perfect scenario rarely, if ever, exists. If your current web host is not giving what you need, it might be time to shift to a new one. Moving your site to a new web host doesn’t have to be as tiring as moving to a new house. It can actually be fairly easy if you take the right steps.

There are two routes to transfer a website to a new web host:

Option #1: The easy way

  1. Purchase a new web host with free site migration service
  2. Provide account details at your old web host.
  3. Sit back and let the support team do the rest.

Option #2: Manual transfer

  1. Purchase a new web host
  2. Move existing files, databases, and email accounts to your new host
  3. Final check and trouble-shooting
  4. Switch website DNS records
  5. Wait for DNS change to propagate

 


 

Option #1: Free Host Migration Service

This is the best option for beginners and busy business owners. It is also my preferred way because simply because it’s the easiest and fastest way to get the job done.

Web hosting is a competitive industry – hosting companies are doing all they can to win new customers, including doing the heavy lifting for their new customers. Many hosting companies, including some great ones that I recommend, offer free website migration service. In most cases, all you need to do is request a migration after signing up with the new provider, and their support team will take care of the rest.

Take advantage of this perk to save time and focus on other website work.

Here are the three simple steps you need to do.

1- Signup with a web host that offers free site migration

Hosting companies with free site migration

Hosting companies without free site migration

Avoid these hosts if you want free white-glove website migration service.

2- File a migration request and provide website details

File a migration request with your new web host. Usually all you need to do is to provide login data at your old host – hostname, cPanel login, and FTP login, etc; and your new web host will take care of the rest.

Example: InMotion Hosting

InMotion Hosting Website Tranfer
To initiate a site transfer at InMotion Hosting, login to AMP dashboard > Account Operations > Website Transfer Request. Click here to initiate InMotion free site migration now.

Example: SiteGround 

To initiate a site migration: Login to User Area > Support > Request Assistant (bottom) > Transfer Website. Click here to initiate SiteGround free site migration now.

3- Site back and relax

Yep, that’s all you need to do.

No database error troubleshooting. No email accounts migration. Easy as a pie.

 

 


 

Option #2: Transferring Your Site Manually

1- Purchase a new web host

Apparently you’ll need a new web host in place before you can initiate a host migration.

There are a variety of hosting solutions and providers out there, each with its own configuration. You will need to evaluate and compare which is right for you based on a number of factors, such as cost, required space, and server configuration, to name a few.

If you need help – read my web host choosing guide; or make use of Steve’s Hosting Comparison Tool at WHTop.com.

Also – when purchasing the new host, consider transferring your domain (or registering your new domain) to a third party provider so that in case you do ever need to switch hosts again, your domain can come with you more easily and without any potential complications.

2- Move files, databases, and email accounts 

It’s very simple to move a static website to a new web host – just download everything (.html, .jpg, .mov files) from your old web host and upload them, according to the old folder and file structure, to your new web host.  Moving a dynamic site (with database) takes slightly more work.

Moving your database to a new host

For a dynamic site that runs on database (ie. MySQL), you’ll need to export your database from your old web host and import it to your new web host. If you are on cPanel, this step can be done easily using phpMyAdmin.

Exporting and transferring databases using phpMyAdmin
Login to cPanel > Databases > phpMyAdmin > Export.

In case you are using a Content Management System (CMS, for example WordPress, Joomla), you will need to install the Content Management System a the new web host before importing the database. Some CMS provides easy transfer functionality (ie. WordPress’ import/ export function) – you can use that function to transfer your data files directly using the CMS platform.

Moving WordPress site database.
WordPress dashboard > Tools > Export > Export All Content.

For WordPress sites on cPanel (the most popular setup), the easiest way to move your site is to zip everything in your “public_html” or “www” folder, upload the folder to your new web host, and add the following two lines into your WP-config:

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

Moving your email accounts

Perhaps one of the most difficult parts of switching your web host is transferring your email. Basically you’ll bump into one of these three scenarios:

Scenario #1: Email is currently hosted on a domain registrar (such as GoDaddy)

This email setup is the easiest to move. Login to your domain registrar (where you host your email), change your email hosting A (or @) record to the new web host’s IP address.

Scenario #2: Email accounts are hosted with a third party (such as Microsoft 365)

Ensure that your MX records, along with any other records that your email service provider needs, are updated in your DNS.

Scenario #3: Email accounts are hosted with the old web host

For this scenario, you will need to re-create all existing email accounts in your new web host. The process can be a little tedious – especially if you are running on a lot of email addresses.

Adding an email account at InMotion Hosting (using cPanel).

I have written a detail guide on how to setup and configure email hosting, please read this guide in case you need more help.

3- Final Check & Trouble Shooting

Once you have loaded your files onto the new hosting configuration, double check that everything is working properly on your website

Some hosting companies provide a development staging platform (ie. SiteGround) so that you can easily and fluidly preview your site before taking it live in the new environment, allowing you to remedy any problems behind the scenes.

Repairing site navigation errors and missing links

As you transfer your site’s assets from the previous hosting environment, it is possible for assets, such as graphics to be misplaced or for certain files to be left behind. If this happens, your visitors are likely to experience 404 errors. Keep an eye on the 404 log during and after the switch – this log will alert you of any non-working links or assets that you need to remedy to restore your site to being fully functional.

In most cases, you can make use of .htaccess redirectMatch and redirect to point old file locations to new ones. The following are some sample codes you can make use of.

Define your 404 page

To minimize the damage cause by broken links – where moved.html is the page you wish to show your visitors when there’s a 404 error.

ErrorDocument 404 /moved.html

Transferring a page to a new location

Redirect 301 /previous-page.html http://www.example.com/new-page.html

Transferring entire directory to a new location

redirectMatch 301 ^/category/?$ http://www.example.net/new-category/

Redirecting dynamic pages to a new location

And, just in case you change your site structure at the new host –

RewriteEngine on
RewriteCond %{QUERY_STRING} ^id=13$
RewriteRule ^/page.php$ http://www.mywebsite.com/newname.htm? [L,R=301]

Troubleshooting database errors

There’s risk where your database could be corrupted during the switch. I will use WordPress as example because that’s what I am most familiar with.

In case that you can still access your WP dashboard, try to first disable all plugins and see if your database pulls up correctly. Then, re-enable them one at a time, checking the home page each time to make sure it is showing correctly.

Things would get a little trickier if you cannot access your dashboard. Try these different simple steps to see if one works:

  • Re-upload your database, writing over the new database.
  • Check where the corruption error is coming from and try to reupload that file from your old site to your new one.
  • Open the file and check to make sure it is pointing to your new server.

Solution #1: WordPress auto database repair

If those steps do not work, you may have to do a bit of coding, but I’m going to talk you through it.

First, open the new site in FTP and go to your wp-config.php file. The file should be in the main folder where you blog resides. Backup this file before you make any edits.

Look for this wording:

/** Absolute path to the WordPress directory. */

Just above that line, add this wording:

define('WP_ALLOW_REPAIR',true);

Save your changes and leave your FTP program open for now. Open up your favorite web browser. Go to the following address for the rep

http://yourwebsitename.com/wp-admin/maint/repair.php
repair screen
Either button will work to repair your database but just pick “Repair and Optimize”.
repaired database
When the process is completed, you will see a screen that looks the one below. It will even remind you to remove that repair line from your configuration file.

Solution #2: phpMyAdmin

If the above methods don’t work, your next step is to head over to your database.

This can be daunting if you aren’t sure exactly how databases work, but the steps are fairly simple. Even if you completely destroy the database, you should be able to just re-download from the old server and upload again. There really is no need to be afraid as long as you have your database backed up.

Access phpMyAdmin from your new web host. Choose your WordPress database. This typically is titled yoursite_wrdp1.

However, this can vary. You will likely see “WP” somewhere in the title, though (see image below). You can also find your database name listed in that wp-config.php file that you had open in the step above. Click on the database name in phpMyAdmin to open it.

choose database
cPanel > Access phpMyAdmin > Click on the database name ito open it.
check all
Once the database loads, check the button that says “Check All / Check tables having overhead”.
repair-table
Choose “Repair Table in the drop down box to the right of where you just checked the box.
successful repair
You’ll be given a status about whether the tables were repaired and the top of your screen should say “your SQL query has been executed successfully”.

4- Switching DNS Records

godaddy dns record

Next, you’ll need to switch your website’s DNS record to the new web host’s servers at your registrar.

Your DNS record is a list of “instructions” that specifies where to send the user; moving your DNS record to the new servers ensures that visitors will find your site as intended, rather than receiving an error or misdirect. This is a critical step – make sure you get the right DNS info from your new web host.

Here are the step-by-step instructions on changing your website DNS at Godaddy, Name Cheap, and Domain.com.

5- Wait for the DNS change to propagate

Once you have requested to move your DNS record, the switch can take anywhere between a few hours to a full day to take live.

Once the switch go live, alert your former hosting company as to the cancellation.

And you are all done!

A little more on website downtime management

To ensure that your website do not experience any downtime during the transfer process, you need to ensure that everything is in place and working correctly at your new host before switching the site DNS.

Ideally, you should also inform your visitors and/or clients that you are transferring your website to a new web host, along with information about the hours that you are making the switch.

This should reduce the number of site visitors during the migration, hence eliminating strain on the system and preventing any customer service headaches.

Once the switch is done, it’s recommended to monitor your site uptime closely to ensure everything at the new host is working alright.

Bottom Line: Get Rid of Your Lousy Host Today

Making the switch to a new web host can be a stressful time, but it’s the best thing to do when you are stuck with a bad web host.

If you’re already running a website, you shouldn’t have any trouble with the switch – after all, it’s just the usual backup/download/upload stuffs that you are already doing daily.

If you have any additional tips for making the switch that I have not already mentioned above – or if you have any questions – please let me know!

Also read –

Article by Jerry Low

Geek dad, SEO data junkie, investor, and founder of Web Hosting Secret Revealed. Jerry has been building Internet assets and making money online since 2004. He loves mindless doodling and trying new food.

Get connected: