7 Steps to Move WordPress to a New Host

Today I wanted to talk about the steps that help to transfer the site from the old hosting to a new one. These are the steps that I took when I moved my site. Here I will not talk about the traditional method, which is about the method of backup copies in the cpanel, but I will present to you another way that is much better and you will avoid many The problems will be quick, God willing, to transfer the site. The important thing is to follow the steps in order to get used to using it in times of necessity or if someone asks you to transfer the hosting (service ๐Ÿ™‚ $). With God’s blessing, we begin to explainAs I indicated, these steps are not customary in transferring the site from one hosting to another, but rather it is a personal experience and I found it easy and without problems.

1 – Compress files

The first thing we will do is compress the entire siteโ€™s files into one file, and it is recommended that the compression format be zip, for hosts that use cpanel, we will compress all the files inside the public_html, now the important question is how do we compress these files? The answer is in the following steps:

First, we log in through the file manager via cpanel, and then we choose the main domain of the site

filemanager - WordPress Magazine

After entering the main site folder through the file manager, so that you will not have problems, make sure that you are in public_html

checkpath public html - WordPress Magazine

After making sure that you are in the public_html folder or the main folder of all files, including the subdomains and other domains folders, we select all files as in the following image:

select all and ready 4 compress - WordPress Magazine

By clicking on select-all and then we will click on compress as in the image above indicated by the yellow circle. After that, the following window will appear for the pressure settings:

compress files - WordPress Magazine

Here we choose the type of zip compression because it is the fastest and also the one that we can quickly decrypt in the case of the new hosting that does not support cpanel. After changing the name, press compress files, wait for a while until the compression completes, depending on the size of the files you have, for me the last time was 528mb, and do not care about the size of the files, we will transfer them quickly through a next step

wait 4 compress - WordPress Magazine

After completion, a window will appear containing the pressure information, close it

close compress notify - WordPress Magazine

Now we have finished compressing all the site files. In this case, you will find a file with the name that I gave in the compression process, and in our case now it is files-to-transfers.zip

compress files saved - WordPress Magazine

Do not delete the file from the main site folder, because we will transfer it directly to the new hosting without the need to download it to the device and re-upload it. We will discuss how to transfer files in the next stepsThis method is only for people who own cpanel or have another control panel such as confixx or directadmin, and by the way, maybe these panels do not contain the file compression feature, you and your luck ๐Ÿ™‚

2 – Export the database

Now we will export the database to WordPress. In this step, I will do it for one rule. If you have other rules, export them as well. The method is very easy and does not have any complexity. All you have to do is follow the following steps:

From cpanel we go to the databases as in the following picture and choose phpmyadmin:

select phpmyadmin - WordPress Magazine

After clicking on phpmyadmin, it will be directed to another page. Wait for a while until the phpmyadmin control panel appears. After that, we choose the rule to be exported, as in the following image:

database select - WordPress Magazine

By the way, if you have other databases, you must export them since you will move to another hosting. The important thing is after clicking on the rule to be exported, the tables in it will appear. We select all the tables without exception and export them by clicking on the export as in the following picture:

select and export - WordPress Magazine

After clicking on export, you will be taken to the export execution page. All you have to do is press the button indicated in the following image:

download databse - WordPress Magazine

After pressing the button, the rule will be displayed to download and store it in the desktop or anywhere in the device so that we can return to it from afar, either to make some modifications to it or import it directly without modification

After exporting the file to the device, open it with any text editor and make sure that there is something like the code below at the beginning of the file because sometimes a corrupted file is exported or has errors in other words

-- phpMyAdmin SQL Dump
-- version
- http://www.phpmyadmin.net
-- Host: localhost
-- Generation Time: Dec 14, 2016 at 07:39 PM
-- Server version: 5.5.00
-- PHP Version: 5.3.3

SET time_zone = "+00:00";

/*!40101 SET NAMES utf8 */;

-- Database: `beta`

Now we will move on to working on the new hosting to transfer files, decompress them, create and import databases, and modify the database connection files.

3- Transfer the files to the new hosting

Here we will transfer the files from the old hosting in a faster way by downloading them directly to the new hosting via php. to-transfer.zip)

The php code that will help us transfer files depends on the curl function I found on PHPRiot and I modified it a little to find out the location path automatically to save the file in

	$gpath = getcwd();
	$url = "https://www.mwordpress.net/files-to-transfer.zip";
	$path = $gpath."/files-to-transfer.zip";
	$fp = fopen($path, "w");
	$ch = curl_init($url);
	curl_setopt($ch, CURLOPT_FILE, $fp);
	$data = curl_exec($ch);

Here, create a file named get-files.php and copy the above code in it and modify the link of my site in line 3 of your site and the name of the file that you gave while pressing, after modification, upload the file to your main site folder in the new hosting

Since we have not changed the domain settings yet, you must know the IP number of your new hosting and also the user’s username. To know these things, follow the following steps:

First, we get this information from the main page of the cpanel control panel in the left side menu

The user is usually in the home directory, I hid it for certain and security reasons as well ๐Ÿ™‚:

usercpanel - WordPress Magazine

IP number You will find some pressure on expand stats below, as in the following image:

ipserver - WordPress Magazine

Now that we got the user and the IP, we display the file that contains the php code for downloading files from the old host to the new one from the browser, which we called (get-files.php) as follows: ~ User /get-files.php

Do not delete the mark indicated in green, just change the IP and User after modification, view the file from the browser and wait a little while until the files are downloaded. The file has been uploaded successfully, and here we will move on to the next step

4 – Decompress the files

In this step, we will decompress the file that we downloaded from the old hosting by the previous step. The matter is easy and does not require much effort. Just choose the file and decompress it as in the following picture:

extract files - WordPress Magazine

And congratulations on transferring files quickly without sitting for hours while you wait for the files to be downloaded to the device. They have been uploaded from a device. In this way, we have shortened the time and effort.

5 – Creating databases and modifying database connection files

Here, after you have successfully transferred and decompressed the files, you will create empty databases with the number of databases you had in the old hosting and modify the wp-config.php files by changing the old connection information with the new one you made about creating the rules in the new hosting that’s it for this The step is clear, I think

6 – Import the base

After we exported the rule in step 2 and saved it in the device, now we will import it. The thing is easy. Of course, there are no steps such as exporting, but only choosing the rule and uploading files to it. Note with me how you will do this step:

We click on Import to upload the database tables

import databse - WordPress Magazine

After clicking on Import, you will be taken to another page that will enable you to upload the file that we exported in step No. 2, and its format will often be sql

settings 4 import - WordPress Magazine

After you select the file and press execute, wait for a while until you see the message that the import is complete, as in the following image:

import ok - WordPress Magazine

Now we have finished the import method, and if you have another rule, do the same for itDo not forget to change the database connection information in the wp-config.php file. Thank you, brother . Mohamed Labbad for the warning

7 – Modify the DNS settings

The last step is to change the DNS settings for a domain in order to work with the new hosting. There is no need to talk about it because it has many explanations and each domain provider has its own control panel. All you have to do is search the Internet and find out the DNS numbers that your new hosting uses.


  1. If you have sub-domains in the previous hosting, do not forget to create them in the new hosting because after changing the hosting, I do not think that these sub-domains will work without adding them again
  2. If you change the domain before transferring the files, do the opposite for the method of downloading files from the old hosting, meaning instead of obtaining the IP and User number of the new hosting, you will obtain it for the old one.


This is my method of transferring the site from one hosting to another. If you find it difficult, there is no need to apply it, although I think it is free of problems and fat ๐Ÿ™‚ I know that most are ashamed of doing thisย 

Leave a Comment