CodeinWP content is free. When you purchase through referral links on our site, we earn a commission. Learn more

How to Move a Website to a New Host (Without Downtime or Issues)

Trying to figure out how to move a website to a new host without breaking anything, causing downtime or any other issues that could hurt your Google rankings?

As with any move, moving your site to a new host can feel a little daunting, especially if you haven’t done it before. However, it doesn’t have to be, and with the tutorial that we’ll share in this post, you should be able to move virtually any website to a new host.

A quick note here – in this post, we’re focused on a generic process for how to move a website to a new host that will work for all websites, including WordPress, Joomla, Drupal, etc.

How to move a website to a new host
Web hosting must-know:

However, if you are using WordPress, there are some tools that make the process a lot easier, and we have an entire guide dedicated just to WordPress and those tools.

๐Ÿ‘‰ Go to our WordPress-specific guide for moving web hosts

But first – does your new web host offer free migrations?

Before you start down the manual road of how to move a website to a new host, we’d encourage you to check whether your new host offers a free migration service (or an affordable paid service).

Many hosts will migrate at least one website for free when you sign up. If you’re moving from one cPanel host to another cPanel host, it’s also usually pretty easy for your host’s support staff to migrate your entire cPanel account, which means you’ll be able to bring everything over in one step.

If you’re still undecided on which host to switch to, some quality and affordable hosts that offer free migration services include:

You’ll also find other hosts that offer professional migration services for an affordable price. Some good options here are:

  • SiteGround – as low as $30/site for professional migrations (or free WordPress migrations using SiteGround’s automated tool).
  • Bluehost – $149.99 to professionally migrate up to five websites.
  • DreamHost – $99 to migrate any type of website (or free WordPress migrations using DreamHost’s automated tool).

If you can swing it, paying for someone else to do the work for you can save you a lot of aggravation, especially if you’re not a technical user.

And if you’re using WordPress and still reading this article, most premium managed WordPress hosts also offer free WordPress migrations. Good options here are:

How to move a website to a new host – step-by-step

If you’re set on manually migrating your site to a new host, here’s a bird’s eye view of the steps that you’ll take in this tutorial:

 
  1. Add your domain name at your new host
  2. Move your site’s files using FTP
  3. Export your site’s database from your old host
  4. Create a new database and import it to your new host
  5. Update configuration details if needed
  6. Test your site
  7. Move custom email addresses
  8. Update your domain’s nameservers
  9. Test everything again

Before getting started, we recommend taking a full backup of your site using whichever method is available. While this process shouldn’t break anything, it’s always good to have a recent backup in hand when making any major changes to your site.

๐Ÿ’ก Remember – if you’re using WordPress, follow our dedicated WordPress migration guide instead. It’s simpler and tailored to WordPress, whereas the method below is a generic approach that will work for virtually any type of website, but is more complicated than it needs to be for WordPress sites.

1. Add your domain name at your new host

Before you can start moving your site, you need to sign up for your new host and add your site. 

 

If you only have one site, you probably entered your domain name already when you signed up for your host. However, if you have multiple sites, you might need to create an Addon Domain instead *:

* Addon domains are what cPanel calls additional domain names – your host might use different terminology if it doesn’t use cPanel.

New addon domains

2. Move your site’s files using FTP

Next, you need to move all of your site’s files to your new host. This might take some time if you have a large site, but you’ll only need to put in a few seconds of manual effort – the rest is just waiting.

The easiest way to move your site’s files is via FTP. To connect via FTP, you’ll need an FTP program – FileZilla is a good free option if you’re not sure where to start, but there are lots of good FTP clients.

๐Ÿ’ก Confused by FTP? Check out this full guide to FTP to learn the basics

In addition to your FTP program, you’ll also need the FTP credentials (host, username, password, port) from both your old host and your new host. You should be able to find these in your hosting dashboard, but you can ask your host’s support staff for help if needed.

Once you have that information, open two windows for your FTP program:

  • Window 1 – connect to your existing host using your FTP credentials.
  • Window 2 – connect to your new host using your FTP credentials.

In both windows, browse to your site’s main folder:

  • Window 1 – you should see all of your site’s files.
  • Window 2 – this should be mostly empty, though you might see a few files from your host.
Open FTP at old host and new host

Select all of the files in Window 1 (old host) and download them to your local computer:

Download all website files

Some FTP programs will let you drag files directly between the two windows, but FileZilla doesn’t currently support this feature. If you’re using a different FTP program, you can check to see if it will let you move files directly.

Once the download finishes, upload all of those files using Window 2 (your new host). You can just drag-and-drop all of the files from your computer into the FileZilla interface.

For a large site, it might take a good bit of time to both download and upload all of the files, so you might want to step away and do something else while you wait.

3. Export your site’s database from your existing host

There are two parts to most websites:

  1. Your site’s files, which you moved in the previous step.
  2. Your site’s database, which usually contains all of your site’s content and settings.

If you just have a static HTML website, you don’t need to move your database because your site doesn’t have a database.

However, most content management systems (CMS) rely on a database to store your content. This includes:

  • WordPress, Joomla, Drupal, Magento, etc.

To move your database, you’ll first need to export your database from your existing host. Then, you’ll import it to your new host in the next step.

To export your database, you can use phpMyAdmin, which is a database admin tool that most hosts offer. If your current host uses cPanel, you should see a phpMyAdmin tool in the Databases section.

Once you open phpMyAdmin, you’ll need to select the database for the site that you want to move on the left (you’ll see multiple databases if you host multiple sites).

Then:

  • Go to the Export tab
  • Select Quick for the Export method
  • Choose SQL for the format
  • Click Go to export your database
Export MySQL database as part of how to move website to new host

4. Import your site’s database to your new host

Once you’ve exported your site’s database from your old host, you need to reverse the process and import it to your new host.

Before you can do that, you need to create a new, empty database at your new host. If your host uses cPanel, you can do that by opening the MySQL Database Wizard tool under the Databases section in cPanel.

While going through the wizard, you’ll be prompted to enter a:

  • Database name
  • Database username
  • Password for your database username
 

If possible, try to use the exact same database name, username, and password as your old host. This will eliminate the need to update configuration settings. If you don’t remember those details, that’s ok – you’ll just need to update configuration files in the next step.

Create a new MySQL database
 

Once you create your database username, you’ll need to give it all privileges on the next screen:

Give database user privileges

After creating your new database, open phpMyAdmin at your new host and select the database that you just created using the sidebar on the left.

Then:

  • Go to the Import tab
  • Use the File to import section to select the .sql.zip file that you exported in the previous step
  • Click Go to import your database
Import MySQL database as part of how to move website to new host

Ideally, you’ll be finished now. However, some CMS tools use database serialization which can cause issues when you export/import your database like this. WordPress is one example where it’s common to encounter database serialization issues.

Unfortunately, we can’t give one blanket recommendation for all platforms here because it depends on the platform (and you might not even experience any problems).

If you experience issues, you can usually use Google to find scripts that can help you fix the problem for your specific platform. For example, here’s a popular script that can fix WordPress database serialization issues.

5. Update any necessary configuration details (depends on CMS)

Again, it’s hard to give specific instructions here because this step will depend on your CMS and how it’s configured.

However, at this point, you might need to update some configuration details in your site’s configuration files or settings to point to the new database that you created (especially if you used a different database name, username, or password).

Here are tutorials for how to update this information for some of the most popular CMS tools:

If you’re using a different website platform, you might need to turn to Google to figure out how your platform handles configuration files.

6. Test your site

At this point, your site should be working on your new host. However, you’ll want to thoroughly test it to make sure it is.

You can’t do this by entering your site’s domain name because your domain name still points to your old host (for now). This is necessary to ensure that you don’t have any downtime during the move.

There are two ways to get around this:

Option 1: Use a temporary URL

Most web hosts give you an option to view your website on a temporary URL before switching domain names.

This temporary URL typically looks something like this: 

https://[cpanel_ip_address]/[cpanel_username]/[domain.com]

For example:

http://171.654.321.000/~colin12/codeinwp.com/

If you’re not sure where to find this temporary URL, we’d recommend asking your new host’s support for help.

Option 2: Edit your computer’s hosts file

Another option to test your site is to edit your computer’s hosts file to point to your new server. This lets you manually override your computer to tell it to use your new server when you enter yoursite.com (all of your other visitors will still be taken to your existing host for now, though).

First, you’ll need your server’s IP address, which you can find in cPanel (or, your host usually includes this in your welcome email):

How to find server IP address

Then, you’ll need to edit your hosts file:

How to edit the hosts file on WindowsHow to edit the hosts file on Mac

You can find the hosts file in C:\Windows\System32\drivers\etc. It may be hidden, so you might want to adjust the file display settings to see it.

The hosts file has no extension but it’s in plain text format, which means that you can open it with Notepad or any other text editor (just right-click and tell Windows to open it with Notepad).

At the very end of this file add a new line like this:

YOUR.SERVER.IP.ADDRESS YOURDOMAIN.com

For example:

10.21.11.192 YOURDOMAIN.com

Save the file.

To get started, open the Terminal app – you can find it via App Launcher.

In Terminal, type in sudo nano /etc/hosts and hit enter.

Then, enter your admin password and hit enter.

You should now be in the Nano text editor with your hosts file open.

Nano text editor

Position the cursor at the bottom using the arrow keys.

Add a new line at the very end of the file:

YOUR.SERVER.IP.ADDRESS YOURDOMAIN.com

For example:

10.21.11.192 YOURDOMAIN.com

Once you’ve added the line, hold down the “Control” and “O” keys to save the file. Then, hold down “Control” and “X” to exit.

After editing your hosts file, you should now see the new version of your site when you browse to your domain name.

Once you’ve verified that your new site works properly, you’re almost finished – just two more steps.

7. Move your email addresses (optional)

If you’re using email hosting from your old host to create a custom email address – e.g. [email protected] – you’ll also want to set up this email address at your new host before you make the switch.

Otherwise, you won’t be able to receive emails once you update your domain name in the next step.

If you’re using email hosting from your host, you can do this by recreating your custom email addresses at your new host via cPanel:

Add a new email account

If you’re using a separate email hosting service (such as G Suite), you might need to change the MX records in the DNS settings at your new host once you point your domain name to that new host in the next step.

8. Update your domain name to point to your new host

Once you’ve verified that the migrated version of your website is working properly, the final step in how to move a website to a new host is to update your domain name to point to that new host.

When you make the update, visitors will be taken to the new version of your site at your new host, with no downtime.

Typically, you’ll do this by changing your domain’s nameservers, which you can control from the service where you purchased your domain name.

First, you’ll need to locate the nameservers for your new web host. You can usually find these in your hosting dashboard or welcome email. Or, you can ask your new host’s support staff for help.

Your nameservers will look something like this (but unique for each host):

  • ns1.yourhost.com
  • ns2.yourhost.com

Most hosts provide two nameservers, but some will give you three or four different nameservers.

Once you have your nameservers, here are some tutorials for editing nameservers at popular domain registrars:

For example, here’s what it looks like to edit a domain’s nameservers with Namecheap:

How to move a website to a new host by changing domain nameservers

9. Test everything again

Now, you’ll need to wait for a little for the change that you made to your nameservers to take effect. This can take up to 24 hours, but normally it’ll only take 30-60 minutes.

Once the change takes effect, you should be able to access the version of your site at your new host when you go to your domain name.

Take another moment to make sure that everything is working:

  • Browse around to different pages
  • Test your forms
  • Make sure you can receive emails (if using custom email addresses)
  • Etc.

If everything is still working, you’re officially finished – that’s how to move a website to a new host without any downtime!

Have questions about how to move a website to a new host? Ask away in the comments and we’ll try to help!

Don’t forget to join our crash course on speeding up your WordPress site. With some simple fixes, you can reduce your loading time by even 50-80%:

 

Layout and presentation by Karol K.

* This post contains affiliate links, which means that if you click on one of the product links and then purchase the product, we’ll receive a commission. No worries though, you’ll still pay the standard amount so there’s no cost on your part.

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (itโ€™s free)!

Most Searched Articles

14 of the Best JavaScript Libraries and Frameworks to Try Out in 2020

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

50+ Best Free WordPress Themes for 2020 (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than 60+ such themes for you right ...

10+ Best WordPress Hosting Providers of 2020 Compared & Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10 best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for Beginners and Advanced Users Alike

Many people wonder how to make a WordPress website. Theyโ€™ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an eCommerce Business From Scratch (In 10 Steps)

Is 2020 going to be the year you learn how to start an eCommerce business from scratch? Youโ€™re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...

Scroll to Top