...or how to move a website to a new host without problems.
If you’ve got a long experience with WordPress, you have probably realized that there's no easy way to transfer a WordPress site to a new host. Moving or migrating a website to a different server or domain is not a trivial task. Simply moving the files and database over to the server, isn't enough to transfer a website to a new hosting. Most likely you'll find lots of Error 500s and Internal Server Errors due to misconfigured .htaccess files or other redirects to your old domain or website. So here's a full guide on how to move a WordPress website to a fresh host without any problems.
The solution to these problems will vary depending on whether you’re moving WordPress but keeping the same domain name, or if you’re moving to a completely fresh domain as well. We've done this several times at www.collectiveray.com, so at this point, we're very familiar with the whole process.
The easy way out
If your current server is not cutting it and you need to transfer your website to a new hosting, you don't have to do it yourself or learn to do it using this tutorial. InMotion hosting can actually do the transfer for you for free. Not only that, but you can rest assured that your website will be much faster on InMotion. Have a look at our InMotion hosting review and our how our InMotion VPS performs (hint - very fast!).
If you're interested in other WordPress tutorials, we feature in-depth articles often on this site.
Transfer site using migration plugin
If you are not confident in your ability to perform migrations the manual way, the easiest way to do a migration to a new host is using one of the existing plugins out there which are specifically written to be able to transfer websites cleanly from one hosting to another.
There are many plugins you can use, we will mention two which we know and have used and can reliably recommend.
The first time we encountered this plugin was when we migrated one of our sites to WPEngine. As you might have experienced (or not, as the case may be), a migration is not always a smooth experience, and given that this was a live site which was generating revenue for us, we were a bit hesitant of the move. Yet we were moving to a better, faster host, so we had to bite the bullet and get this done.
Fortunately, the host (WPEngine) actually offered a built-in service which helped us do the migration - this was essentially using the plugin BlogVault - essentially this is a backup and security plugin, which can duplicate as a migration plugin.
Our experience was the smoothest experience ever when it comes to performing a migration. We've also fully reviewed the service here, and we gave it an excellent rating, given the broad set of backup, migration, restore and security functions it provides.
A small pre-requisite of this plugin is that you have a clean installtion of WordPress on your destination server.
Step 1: Perform a backup on the source site
We simply installed the plugin on the source site, performed a full backup of the site and then clicked on the Migrate option as per below.
Step 2: Enter the FTP details of the destionation
Once we had a backup ready for migration, you have to fill up the FTP details of the destination (i.e. where your new website will be migrated to - the new host in other words).
The details you’ll be required to fill in about the new host, are the below. You can get all of these details from your new hosting account.
- The destination’s FTP Hostname or Server name
- The type of the destination’s FTP hosting service (FTP, SFTP, or FTPS)
- FTP username / password of the new hosting service
These details above are then used by BlogVault to get access the new domain, and be able to move your backup’s content automatically to your new location.
Step 3: Migrate the site (full or partial)
The third and final step of the transfer to the new site is the actual migration. You'll first need to select where you want to migrate the new site too, simply select the folder where you have setup the site (on the destination) and click on Continue.
The final step before migration is choosing what you want to actually transfer:
- The whole site
- The files only
- The database only
Most people will (and should) migrate the whole site, but if you have specific use-cases where you only need to migrate the database or just the files, as you can see this is also possible.
Once you have confirmed the that everything looks right, click on the Continue and the transfer will start. You'll see that from this point onwards, there is no other intervention required - once the plugin gives you a "Migration completed successfully" message, you can visit your new site and confirm that everything was moved correctly.
You'll notice that there is absolutely no downtime, neither of the sites needs to be put in maintenance mode, or any tweaking for files or databases needs to be done manually. This is because, any required changes are down as the files are being transferred through BlogVault's servers.
Need help getting your website transferred? Try these top-rated affordable gigs on Fiverr!
Transfer a website to new hosting (manually)
If you just need to move WordPress website to a newly created hosting account while keeping the same domain name, then the process is fairly simple. You will first need to export and import the db content from the old server to the one where you are moving, and then migrate / copy the files with a file manager or FTP. This is a fairly simple process which we will show in detail below
1. Export the Database from the old host
First, we need to migrate the database. The easiest way to do this is through your cPanel account specifically through phpMyAdmin - the db management tool. Select your db from the list and click on the Export tab at the top of the page.
The options to select are as follows:
- Export Method: Custom
- Table(s): Select All
- Output: Save output to a file
- Output Compression: gzipped
Click the Go button at the bottom of the page to start the export and download the file which is generated.
2. Import the Database to the new host
The next phase in transferring the website to a new host is replicating the db content on the server account where you will now be hosting the site. So now we need to take the file we just exported and import it into our new hosting. To do this, start by logging into the cPanel account and creating a fresh database using the MySQL Wizard tool or whatever you prefer. Remember to take note of the db name, username and password for your fresh WP website because you will soon need them to connect the migrated database to the freshly migrated installation.
On the fresh hosting server, you will be transferring your WP site to, go to phpMyAdmin again. Select the db you have just created from the left sidebar again, and then click on the Import tab at the top instead.
Browse to find Find the export file we have just exported and downloaded, and click the Go button. Wait until you get a confirmation that your file has been successfully imported by seeing a message similar to the below.
3. Compress and Move WordPress Files with to the new hosting
Now that the db has been successfully transferred from the old website to the new hosting, we also need to move the WP install files. There are many ways of moving files from one server to another including File manager, FTP, SSH, and so on. For the sake of keeping things simple, we’ll use FTP, since it’s a fairly standard way of uploading and download files between a computer and the server. Another easy way is to login to the CPanel File Manager, compress all the files, download the generated file, move it with FTP, then uploaded and extract on the fresh hosting account.
The way to do this is to create a folder on your computer, then login to your old web server via FTP using an FTP client such as Filezilla (for Windows) or Transmit (for mac).
Then go into your public_html folder and simply select all files and folders. If you compress them first, the transfer will be much quicker, so we recommend you do that. Once they are compressed, download them into the folder you created.
Once the files have been downloaded, log out of that FTP connection and login to your fresh server’s FTP. Then you will go into public_html folder again, and this time, upload all the files from the folder on your desktop. Selecting all the files, compressing them and downloading the resultant single archive file makes the process much much faster! Again, you can also use the CPanel file manager directly, this makes the transfer of the site to the fresh host even simpler, because you don't need to know any extra passwords and no extra software. Of course, if your internet connection is slow, the moving of site files to the host may be slow. That's when FTP becomes a must.
4. Change WordPress Database Credentials
Once the files have been uploaded (and decompressed if you have compressed them), there is one last step to perform to complete the moving of WordPress to a new host. This is to change the database credentials from the ones which were valid for the old site, to the newly created db_name, on the hosting account which you have just imported everything into.
Open the file wp-config.php with a Text Edit and change the following 3 values: DB_NAME, DB_USER, and DB_PASSWORD. Change those settings to the values which you created in Step 2. Save the file, refresh the site and verify that it the fresh website is working ok!
Note: If you have not yet changed the DNS settings on your domain to point to the migrated server, you will want to do that right now.
Transfer a WordPress site to a New Host with a Different Domain Name
The process of moving to a different domain name is a bit more complicated because the WP db has many instances where the domain name is stored. Without changing all those records, the migrated website would not work well.
1. Manual Migration
The manual migration will be identical to the “Transfer a WordPress site to a new host” part we went over earlier. After we do the import of the database on the newly setup server, we will also need to do a Find and Replace for the old domain. This is because, during the move to the fresh hosting, the domain name remains intact in the db content. This will create all sorts of problems which we need to fix after the transfer.
2. Running Find and Replace on the Database
To avoid any issues, we will use a script which is built specifically for this purpose - the Database Search and Replace Script in PHP. Download this script so that we can run it on our website. Upload the script to the same location on the newly created hosting server where you uploaded the fresh site.
To run this script, visit the location of it by typing in the browser, <www.newdomain.com>/Search-Replace-DB-master/. The script will present you with a page which allows you to specify the fresh db credentials.
If it is able to find your wp-config.php file, it will auto-populate the db name, username, and password fields. If not, you will need to manually enter the details.You should also type your old domain name in the replace field and put the fresh domain in the search/replace field.
Before running the actual process, click on the dry run button which performs a test run. If everything is ok and there aren’t any errors, then you can proceed with the live run. This will now actually change the domain which will result in permanent changes to your database - it is advisable that you keep the old website export just in case.
Once it has completed successfully, you are ready to try to access your freshly-migrated website to make sure everything is working fine. If everything went well, you should now be able to use your migrated website on your fresh domain and your new hosting server!
Update DNS to point to new server
Once you have confirmed with your testing that your new site is working correctly on it's temporary URL, you can now perform the actual move of the live site to the new destination - because in all likelihood, your domain still points to the old server.
This is done by updating the DNS settings to point to your new site address - note that you'll need to have access to the registrar where you have bought the domain.
Before you perform the updates, you will need to obtain the nameserver information from your new host. If you're not familiar with this, open a support call with your provider. As an example of nameservers, see below:
To update the DNS settings, look for the domain management area of your registrar, and you should find a section named Nameservers or something along those lines. See below examples, available on GoDaddy domain management.
Once you click on the Manage DNS you'll get to a section where you can update the nameservers for the new host. Click on the Change button and you'll get to the below screen - this is what it looks like on GoDaddy for our own domain:
Enter the NEW nameservers of the new host i.e. the destination host of your transferred site and Save.
You will know need to wait anything from 2 to 48 hours for these settings to propagate throughout all of the nameservers across the world (so don't kill your old website for now).
To confirm whether the DNS has updated, you can check using this service here - which tells you exactly which locations around the world have updated to the new settings or not.
Since both the source and destination website are still up - you'll have no downtime whatsoever.
We would advise that you don't perform a lot of changes until you can confirm that you are completely on the new site, and especially any settings which need to be seen by ALL users. We would recommend that you keep your account for at least a week after your have migrated your site to the server (just in case something goes wrong and you have to revert).
Ideally, you should perform the migration or transfer during a low traffic time of your website (for example in the weekend).
Conclusion - how do you transfer WordPress sites to a new hosting?
There are many ways to transfer a WordPress site to a new host or server. Although there are many ways of doing it, there are few well-documented articles about moving WordPress and inexperienced developers or web designers often have problems with migrations.
If you have another way to transfer a WordPress website to a new hosting server, we'd love to hear about it in the comments!
Please leave a useful comment with your thoughts, then share this on your Facebook group(s) who would find this useful and let's reap the benefits together. Thank you for sharing and being nice!