Step-by-step: Transfer a WordPress site to a new host or server

...or how to transfer a website to a new host without problems.

If you’ve got a long experience with WordPress, you have probably realised that there's no easy of way to transder a WordPress site to a new host. Moving or migrating a website to a new server or domain is not a trivial task. Simply moving the files and database over to a new server, isn't enough to transfer a website to a new host. 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 transfer a WordPress website to a new host or server without  any problems.

The solution to these problem will vary depending on whether you’re moving to a new server but keeping the same domain name, or if you’re moving to a completely new domain as well.Transfer a WordPress site to a new host or server

The easy way out

If your current server is not cutting it and you need to transfer your website to a new host, you don't have to do it yourself. 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 InMotion VPS review.

Transfer a website site to a new host

If you just need to transfer WordPress website to a new host while keeping the same domain name, then the process is fairly simple.  You will first need to export and import the database from the old server to the new one, 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 database management tool. Select your database from the list of databases 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

phpmyadmin export of database to prepare for WordPress transfer to new host

Click the Go button at the bottom of the page to start the export and download the file which is generated.

  1. Import the Database to the new host

The next phase in transferring the website to a new host is replicating the database on the new server account. So now we need to take the database we just exported and import it into our new WordPress hosting server.  To do this, start by logging into the new cPanel account and creating a new database using the MySQL Database Wizard tool. Remember to take note of the database name, username and password for your new WordPress website because you will soon need them to connect the new database to the new migrated WordPress installation.

On the new hosting server you will be transferring your WordPress site to, go to phpMyAdmin again. Select the database 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 database file we have just exported and downloaded, and  click the Go button. Wait until you get a confirmation that your database has been successfully imported by seeing a message similar to the below.

transfer wordpress site to new domain - phpmyadmin import success

  1. Compress and Transfer WordPress Files with to the new host

Now that the database has been successfully transfered from the old website to the new website hosting server, we also need to trasnfer the WordPress 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 new hosting server.

The way to do this is to create a new 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 new 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 WordPress site to the new 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 transfer of WordPress site files to the  new host may be slow. That's when FTP becomes a must.

  1. 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 trasnfer of WordPress to a new host. This is to change the database credentials from the ones which were valid for the old Wordpress site, to the new database, on the new host 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 database values which you created in Step 2. Save the file, refresh the site and verify that it the new Wordpress website is working ok!

Change database-credentials to that of new WordPress database you have transfered your site to

Note: If you have not yet changed the DNS settings on your domain to point to the new server, you will want to do that right now.

5. Transfer a WordPress site to a New Host with a new Domain Name

The process of moving to a new domain name is a bit more complicated because WordPress database has many instances where the domain name is stored.  Without changing all those records, the migrated WordPress website would not work well.

Manual Migration

The manual migration will be identical to the “Transfer t a WordPress site to a new host” part we went over earlier. After we do the import of the database on the new server, we will also need to do a Find and Replace for the old domain. This is because during the WordPress transfer to the new host, the domain name remains intact in the database. This will create all sorts of problem which we need to fix after the transfer.

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 database. Upload the script to the same location on the new hosting server where you uploaded the new WordPress site.

To run this script, visit the location of it by typicingt in the browser, <www.newdomain.com>/Search-Replace-DB-master/. The script will present you with a page which allows you to specify the new database credentials.

php-find-replace to transfer WordPress site to new host and domain

If it is able to find your wp-config.php file, it will auto populate the database name, username, and password fields. If not, you will need to manually enter the database details.You should also type your old Wordpress domain name in the replace field and put the new Wordpress domain in the new domain field.

Before running the actial process, click on the dry run button which perform 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 database which will result in permanent changes to your database - it is advisable that you keep the old database export just in case.

Once it has completed successfully, you are ready to try to access your new Wordpress website to make sure everything is working fine. If everything wentwell, you should now be able to use your new Wordpress website on your new domain and your new hosting server!

Conclusion - how do you transfer WordPress sites to a new host?

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 WordPress transfers and new developers or web designers often have problems with WordPress migrations. 

If you have another way to transfer a WordPress website to a new server, we'd love to hear about it in the comments!

 

One more thing...

Do you have friends or a Facebook group who you think would find this useful? Share this with them and then let me know what they think.

Want to supercharge your website?

 
Our website loads FAST ... just 1.29 seconds. We're hosted on FAST InMotion VPS servers We want YOUR website to be fast too, so we've gotten you an exclusive deal - 47% OFF for DART Creations friends + FREE domain! Check it out NOW!