How to Migrate Your WordPress Site to a New Host?

Would you like to move your WordPress site to a new host or server? Data loss and downtime are the biggest risks when switching web hosting or migrating a website. Both may prevent users from accessing your website, resulting in lost sales and rankings. The purpose of this tutorial is to show you how to safely migrate your WordPress site to a new host without any interruptions.

How to Migrate Your WordPress Site to a New Host?

In spite of the fact that there are important steps to migrate your WordPress site, following our guide can make the process easier. Many people find themselves requiring a new host because they have had enough of their current provider. However, migrating to a more reliable host is often delayed for fear of making a mistake and damaging their site(s). There are several options to get around this problem: People can hire a professional to move their site. Or they can find a new host that offers a migration service as part of a new hosting package. Finally, there are those readers who choose to do it themselves. You can easily reverse the migration process if any problems arise. If you spend a little time preparing your own website, migrating is not a problem.

3d websites

Arashtad Custom Services

In Arashtad, we have gathered a professional team of developers who are working in fields such as 3D websites, 3D games, metaverses, and other types of WebGL and 3D applications as well as blockchain development.

Arashtad Services
Drop us a message and tell us about your ideas.
Fill in the Form
Blockchain Development


1- Make sure your website files are backed up

Backing up every aspect of your site is the very first step before migrating. it should be part of your general WordPress security, and it is good practice before any major changes. however, migrating your WordPress installation requires it as so much data is being transferred. What are the steps you take to back up your website? WordPress backup plugins are available and can be used to manage which files are backed up, how often, and where backups are stored. With a backup plugin, you usually install and then use built-in settings.

It is a good idea to use a plugin like WPvivid. this plugin has tons of powerful backup options, including scheduling, restoring points, limiting files, filtering large files, splitting backups, backup themes and plugins, remote storage compatibility, multisite support, and more. You can also take a more manual approach. To summarize, manual backups require a file transfer tool (FTP) to access your website files. You can connect to your website’s server by using FileZilla (PC) or Transmit (Mac). Once installed, you will need SFTP credentials (from your web host account). Download all the files in the website’s directory, including the .htaccess file, once connected. You can find instructions on viewing hidden files in your FTP program’s help file. This could take some time, depending on how many media uploads you have on your site. While the download is taking place, we can make a copy of your database.

2- WordPress database export

It is a simple process to export your database, requiring only a few steps to complete. Log in to your web server’s cPanel account and open the phpMyAdmin application. Click on the Export tab on the navigation menu to select the database that contains your WordPress installation. For what we need, the Quick export and SQL export settings are sufficient. click the Go button to begin the export process and download the file to your computer. The next step is to transfer your files from the FTP server to your computer once the database export and FTP transfer are complete.

3- On your new host server, create the WordPress database

You must create a database into which you can import your SQL data before we can begin migrating to the new web host. Login to your new web host with the user credentials they have provided you and connect to the cPanel software. For our guide, we will use the MySQL Databases application. If your host doesn’t run that application, contact their support team to find out how to create new databases.

To create a database, follow these steps:

1- Create a new database in MySQL with a name that suits your website.

2- Set up a MySQL user (with a strong password).

3- Create a new user account for this user and grant it all privileges.

4- Make a note of the database name, the MySQL username, and the password in case you need them.

4- Make sure wp-config.php is edited

Go to the folder on your local computer where you downloaded your website files. There is a file called wp-config.php which controls WordPress’ access to your database. Keep a copy of this file on your local computer in a different folder. This will allow you to restore the changes you are about to make should something go wrong later. Open the original version of the file and make the following three changes:

1- The name of the database should be changed

Here is the line you need to locate:

define(‘DB_NAME’, ‘db_name’).

This line currently contains the MySQL database name of your old web host in the db_name field. You must change this to the name of the newly created database.

2- Rename the database user

You will find the following line below:

define(‘DB_USER’, ‘db_user’).

Your old host’s db_user portion needs to be replaced with the new host’s username in this line.

3- Changing the password for the Database User

The third line should be edited as follows:

define(‘DB_PASSWORD’, ‘db_pass’).

In the same way as with all other lines in wp-config.php, you must replace the db_pass section with the secure password you created for your MySQL user. Save the file and close it.

5- Import Your WordPress Database

With the new database in hand, we can begin the import. Using your new server’s cPanel software, launch phpMyAdmin and select your new database from the list on the left-hand sidebar. Once it opens, select the Import tab. Choose the SQL file you exported previously from the File to Import section. uncheck the Partial Import check box, ensure that the format is SQL, and click the Go button. the database import will now begin. You should receive a message once the import is complete informing you of its success. the time it takes depends on the size of your database.

6- Upload The WordPress Files To Your New Host

Now that you have the new database prepared and you’ve reconfigured the wp-config;php file, it is time to begin uploading your website’s files; Connect to your new web host using your FTP program and browse to the folder that your website is going to be held; If this is the primary, or only site being installed on this web server then uploading the files to the public_html folder is the usual directory; With the remote directory selected you can upload your website files that should now include the updated version of wp-config;php; As with the earlier download, this process can take some time; Don’t delete these files from your local computer once the upload finishes; They are still needed until the final steps have been completed;

7- Defining New Domain & Search/Replace Old Domain

If you are moving to a new/different domain then you should read over this step, if not, then you can skip this because you don’t have to update your site to point to a different domain.One issue people always seem to have when moving their site is that they’ve added links to other posts on their site or inserted images directly by pointing to a URL on the server, causing these to break when moved over to a new domain. If you want to quickly and easily search for any instances of your old domain name and replace it with the new name we suggest you take a look at the Search Replace DB script on GitHub. This will allow you to do this with great ease. Just make sure you DELETE it when you are done (for security reasons) and don’t place it in your root domain, create a temp folder with a random name to host the script.

Changing Site URL: By doing a search and replacing the old domain and replacing with the new domain you’ll also be altering the site_url and home URL values in the database (Changing the Site URL) which will ensure that when you try to log into your site on the new domain it doesn’t try and redirect you over to the old domain.

8- Final Touches

This step actually includes two separate mini-steps with (potentially) several days between them.

1- before you can use the site on your new host you will need to reconfigure your domain’s DNS settings. They will be set to point to your old host and you will need to point the correct records to the new server IP address.This process will depend on where you have your domain registered. The details of completing this process are too varied to discuss in this post, but your domain registrar should have all of the details you need to make this change.DNS changes can take up to 48 hours to fully propagate. It’s best to do this at a period when you expect lower levels of traffic. During this 48-hour window, you should avoid making any changes to your website as you may be changing the old version of the site.

2- after the 48-hour period has expired you should now be accessing the new web host when you go to your website. It’s at this point you can connect to your old web host to delete the files and database. You should still have a local backup copy of these files and the database export, along with the original wp-config.php file in case you need to roll back the migration. It can be a good idea to hold onto these files for an extended period just to be on the safe side.

Wrapping Up

As you can see, when broken down into the above simple steps, the process isn’t that difficult. All it really requires is for you to be careful at each step and give yourself the option to go back to the original version until the last possible moment (in case of any problems).

Download this Article in PDF format

3d websites

Arashtad Custom Services

In Arashtad, we have gathered a professional team of developers who are working in fields such as 3D websites, 3D games, metaverses, and other types of WebGL and 3D applications as well as blockchain development.

Arashtad Services
Drop us a message and tell us about your ideas.
Fill in the Form
Blockchain Development