How do you move a WordPress website to another host or domain?
By: Richard Detering
Tags: Web Hosting Services, Web Hosting, Transfer Website, Website, Web Hosting Provider

Photo by Moritz Mentges on Unsplash

Moving your WordPress website? Why would you do that? For example, if you regularly get 503 and 404 errors that cannot be explained and your website is down. Your website is completely up-to-date and yet it remains a pain to keep your website up and running. A website that does not function properly costs money and customers. So time to move website.

You have searched for good WordPress hosting and you finally found the ideal provider such as, for example Linux Hosts Inc. But there is a problem. How are you going to handle this? And will everything on your website remain as it was? Are you not losing anything? And your e-mail, does it move with you? A lot of questions. What is involved when moving your WordPress website? Read it here.

The intention of this article is not to provide you with a complete step-by-step plan for the relocation of your WordPress website. There is no standard step-by-step plan anyway, because this differs per website and per web host. The difference lies, among others, in the operating system on the server of your hosting party. You may be using Direct Admin, Plesk or Cpanel. In general, the steps to be taken for moving a website are the same with all these systems.

We move an average of 4 to 10 WordPress websites per week, but we still regularly encounter problems. The purpose of this article is mainly to give you insight into the process of moving a website and to give you some guidelines, if you want to do it yourself. Here they are:

Always make a backup of your website before moving

Get new hosting for your website

Move WordPress website

Search and replace in the database

Transfer domain

Move mail

Cancel old hosting

Conclusion about moving WordPress website

1. Always make a backup of your website before moving

The first step that you should always take is to make a good backup. What is a good backup? That is a full backup of your website containing all files and a complete export of the database. How do you make it? There are several ways to do that. The first is that you use a backup plugin such as Updrafts or WPbackup. If you search for ‘backup’ in the WordPress plugin repository you can find more plugins that can make a full backup.

The second is that you download all folders and files via FTP (with a program like FileZilla, for example) and make an export of your database with PHPMyadmin.

A third option is to make a backup on the server via the control panel of your hosting party and download it when it is ready. We use the backup function of DirectAdmin for this, but you can achieve the same within Cpanel or Plesk.

WordPress backup Updrafts.

We have already written about backups in various blogs, including the blog about the plan of approach for website maintenance. It remains an important, but often forgotten item if you own a WordPress website.

Create a folder on your local computer. Here you save all downloaded folders, just like an export of the database, so that you can easily find them later. If you have used a backup plugin, you can download the backup and extract it. Then you also have all the folders and the database local.

Optionally, you can still download the files via FTP and download the database from PHPMyadmin, whether or not zipped.

2. New hosting for your website

It does not matter where you have requested the hosting. You will always have to set up the storage space for your website. Most hosting providers use a control panel. As mentioned before, this can be Cpanel, DirectAdmin or Plesk. In addition, there are several providers that offer a custom control panel, such as the famous Hepsia control panel from Linux Hosts Inc. This in turn depends on the operating system used on the server and the size of the provider.

WordPress hosting.

In any case, request a new hosting package from your new provider. In this case, we take DirectAdmin as an example, because we often work with it ourselves and we also encounter it a lot with our customers. You do not have to request the domain name from your new hosting provider in this step, you can do that later.

The moment your hosting provider gives you an account and you can log into the server’s Direct Admin, you have the option to create an alias. What is that? Simple, your website is not linked to a domain name, so can only be found on the basis of IP address. To make it easy, you create an alias. So instead of 1.2.3.4 for your WordPress website you will now find it at temporaryurl1234.com or something similar. You can request more information about this from your hosting provider.

If you do not want to create an alias but still want to test whether your website is in the correct location without having moved the domain, you can adjust your host file. This works a bit easier on a Mac than on a Windows Computer, but it is possible on both systems. On a Mac you set the host file as follows:

Open Terminal

Type: sudo nano /private/etc/hosts and hit enter

Enter your administrator password

Complete with 1.1.1.1 (the IP address of your server) www.yourwebsite.com yourwebsite.com

Exit with Ctrl + X and save the changes

For Windows there is a similar way to modify your host file, for this I refer you to Google.

If you now go to yourwebsite.com you will see your website via the new server.

Now install your WordPress site on the new environment. There are roughly three ways to do this:

You download all the files from WordPress.org and upload them via FTP to the correct folder on the new server and you create a new MYSQL database. Make sure you save the login details of the database, you will need these during the installation. Then you start the famous ‘5 minute installation’ of WordPress.

For example, use the Hepsia control panel. With this, the provider gives you the convenience that you only have to choose in your control panel which package you want to install and then they automatically take care of the rest.

The provider installs WordPress on your environment immediately after requesting your hosting package.

Your WordPress installation on your new server is ready. But not for long.

3. Moving WordPress website

Moving files to new hosting

In the first step you have made a backup of the database and all your files. The database comes in the next step, what you need now is the wp-content folder from the backup.

WP Content WordPress folders.

Upload this folder via an FTP client such as Filezilla (free) to the same location where, among other things, wp-content is located. Here you will also find the wp-admin and wp-includes folders. You can leave all the folders and just copy the WordPress wp-content folder over them. If you are asked to overwrite files, you can do so without any problems.

Make sure that you really only transfer the contents of the named wp-content folder, not accidentally the separate files such as wp-config.php that are outside this folder. This is because this contains the database information of your new installation. If you overwrite this, the connection to your new database can no longer be made and you can start over again if you are unlucky.

After copying the files you can check if your website works, but that is of no use. So don’t be alarmed if you do it anyway and you don’t see anything or you get an error message.

Moving database to new hosting

WordPress websites use a MYSQL database. There is meanwhile a database filled with the tables of the newly launched WordPress website. There are several ways to import your database.

Via PHPMyadmin. The disadvantage of this is that it is very error-prone. You often run into problems, especially if the database is a few MBs in size.

Via BigDump. This is a script that you place on the new web server in the root of this server. You also place an export of the database (the one from your backup, for example) in the root. Then you go to yourwebsite.com/bigdump.php and you import the old database into your new environment this way. More about BigDump can be found on the developers’ website.

Big dump WordPress database

So after moving the database you have the complete old website on the new server. But it still won’t work. And why? There are references in the database. And these all point to your old website. If your domain name has not been changed, you can skip step 4 and immediately start with step 5, transferring your domain name.

The last point to consider is the prefix of your tables. By default this is wp_

Change the prefix to the prefix of your imported tables in your wp-config.php file.

4. Search and replace in the database

Your database contains references to your old domain. If your complete domain name now changes, so for example your website was yourwebsiteold.com and it becomes yourwebsitenew.com, then use the tool I describe in my article about searching and replacing in a WordPress database.

After searching and replacing in the correct url of your website, you can check whether your website is running on the new location. This will still be in a temporary location if your domain name remains the same. This is because your domain has not yet been transferred.

5. Move mail

Your email is an important step in the moving process of your website. Of course, this only applies if you also use the mail via your domain. So you email via mail@yourdomain.com. The most important thing is that you know whether you use the mail via POP3 or IMAP. Very simply explained: POP3 means that you download the mail from the server. IMAP remains on the server and you can view your mail wherever you log in.

Be the first to create the same mailboxes on the new server that you had on the old server. And keep your login details safe.

But how do you move the mail? For POP3 it’s simple, then it’s just a matter of setting up the new mail servers on the devices where you get the mail. More is needed for IMAP. You generally have two options:

link the old and the new mail server in for example Outlook and move all folders from old to new;

you are using the IMAPSYNC. This is for advanced users, you need to be familiar with the command line on your server.

6. Transfer domain

The last step in moving your WordPress site is transferring your domain. If you have chosen to move your website to another domain, you can skip this step. You may still want to set up a 301 redirect so that people who visit your old domain are automatically redirected to your new domain.

First, you need a transfer key or token from your old hosting provider (registrar). This is a unique code. You simply cannot move without this code. It differs per provider, there are providers where you can get this code directly from the control panel, other providers will email the transfer key to you if you have canceled and others require you to request the code by email.

In any case, providers are obliged to provide this code if you have fulfilled your obligations.

Also note that there can be a lock on a .com domain name. This means that it cannot be moved. You will also need to arrange this with your hosting provider.

Since every provider has its own way of registering a domain, I will not go into that. What I still want to say is that a .com domain will been moved immediately. However, it may take up to 24 hours for all DNS servers to be aware of the change. Other domain extensions can take longer.



7. Cancel old hosting

If this was your only domain with the old hosting provider, you can delete all files here via FTP. You can also delete the database. Why would you leave data that you no longer use yourself? What steps do you follow to remove the entire package?

Delete database;

delete files;

Close account.

Moving WordPress website

8. Conclusion on moving a WordPress website

Are you already dizzy or was it all easy to follow? The approach of this article was quite technical this time. As indicated in the intro, it was not my intention to tell you step by step how to move your website. There are too many variables for that. There is already a difference in the control panel per hosting provider, just to give an example. What kind of problems have I run into in the meantime? I will give a top 5:

PHP versions on the servers differ. A website that runs fine on PHP 5.4 does not have to run flawlessly on PHP 7. Meanwhile, the version of PHP 7.3 is stable so make sure your hosting is also running and check this;

database corrupt. You will often see errors with the import. The best option is to manually adjust the export until there are no more errors. It is also possible that the phpmyadmin version differs per server, if you run into this, my advice is: Google the error message and see what you need to change in the downloaded database file;

Copy WP-Config file by mistake. This is your own fault but it can take a lot of time before you find the solution;

unstable FTP connection without error message. Files get corrupted during upload. If you suspect this, please upload again. Preferably complete, so remove everything first;

transferkey is not accepted by new registrar. Double check the key before contacting the old provider. I have already received the wrong transfer key several times.

domain name locked. A .com domain name may be locked. This means that it cannot be moved until the lock is removed. If you are going to move a website, ask immediately if the .com domain is locked and whether they can unlock it;

website displays a white screen. You may have a plugin conflict on your new server. Test this by temporarily renaming the plugin folder to old-plugins for example. The same goes for the theme. Rename the theme folder to old-theme if renaming plugins doesn’t work. And of course check the error logs on your server.

Moving a WordPress website with duplicator plugin

In addition to the manual method that we have described in this article, there are several plugins that can make the move easier for you. The most famous of these is the Duplicator WordPress plugin. Our experience with this plugin is that it works fine for a basic website, but as soon as it is more complex, for example a larger database, many plugins or the like, the chance of errors is high.

We wrote earlier that it is not a step-by-step plan that we have written since all relocations of websites often proceed slightly differently. But we think it would be useful to once again list all the general steps.

Make a full backup of files + database

Create a hosting package with your new hoster

Install WordPress with your new hoster

Copy the wp-content folder to your new hosting environment

Import the backup of your database into your new hosting environment

Adjust your wp-config so that it contains the correct database information

Transfer your domain name

Move your email

I hope it’s all clear and wish you the best of luck!