How to Move Your Website to Another Web Host?

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 better one (we will talk about knowing when it’s time to switch in the later part of this article). 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: 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

2- Request site migration and provide website details

3- Site back and relax

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.

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 the database) takes slightly more work.

Moving your database to a new host

For a dynamic site that runs on the 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.

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.

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

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

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.

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 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 an 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
Either button will work to repair your database but just pick “Repair and Optimize”.
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.

cPanel > Access phpMyAdmin > Click on the database name ito open it.
Once the database loads, check the button that says “Check All / Check tables having overhead”.
Choose “Repair Table in the drop down box to the right of where you just checked the box.
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

Next, you’ll need to switch your website’s DNS record (A, AAAA, CNAME, MX) 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.

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!

Tip: Use What’s My DNS to perform a DNS lookup to check domain names current IP address and DNS record information from multiple name servers in 18 locations. This allows you to check the latest state of DNS propagation.
DNS Map is another free DNS lookup tool to check DNS propagation status from over 20 locations.

A little more on website downtime management

To ensure that your website does 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.

Knowing When It’s Time to Change Your Web Host

Making the switch to a new web host can be a stressful time – which is why many site owners prefer not to switch web host unless it’s necessary. After all – why waste time and energy when everything is working alright?

So when is the right time to start looking for a new host? How do you know that your web host is the root cause of your website problem? Here are a few hints:

  1. Your site is constantly going down
  2. Your site is too slow
  3. Customer service is not helpful
  4. You need more space, functionality, or other resources
  5. You are paying too much
  6. You have been hacked, more than once
  7. You have heard about a great service elsewhere

Bottom line: A Good Web Host = Better Sleep at Night

When I switched to ASPHostPortal years ago – the tech support was so helpful and switched my site over safely and soundly while I slept. I woke up to a website that functioned quickly and reliably without a single glitch in service.

If you don’t feel that level of comfort or are bothered about negative reports you’ve seen on your web host, it may be time for a change.

Anjali Punjab

Anjali Punjab is a freelance writer, blogger, and ghostwriter who develops high-quality content for businesses. She is also a HubSpot Inbound Marketing Certified and Google Analytics Qualified Professional.