Migration with domain change can be tricky and not for the faint of heart. It is much easier to keep the domain the same and port it over to a new environment and then changes the domain. Then, at the very most, it is just a matter of passwords for the database resident in the root via file: wp_config.php file.
Classicly there are two solutions, based on what environment you are going “to”.
If you have access to the WHM, then you have the lovely tool WHM >> Home >> Transfers >> Transfer Tool. This will do all the work for you.
If not, then you are in for a bit of a harder road, given you want to change the domain name at the same time. The method I have used in the past, is a 2 part solution.
-
Break up the full backup into full source files and the .gz file for the mysql database.
-
Import the database using the PhpMySQL CPanel tool. Make sure the database is empty and import the database directly via the import option.
- Using the Cpanel assign the database name and the password.
- Copy all the files to the HTML folder one for one. Typically this is called “public_html”
- While they are copying you are going to need to manually change the database domain name. There is a good website that explains all the areas you will need to change.
https://help.dreamhost.com/hc/en-us/articles/214580498-How-do-I-change-the-WordPress-Site-URL-
-
Then you will need to modify the wp_config.php, resident in the HTML folder as follows:
/** The name of the database for WordPress */ define('DB_NAME', 'site_wrdp1'); /** MySQL database username */ define('DB_USER', 'site_wrdp1'); /** MySQL database password */ define('DB_PASSWORD', 'password');
and place a rewrite code (since you are changing domain names)
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.newsite.COM/$1 [R=301,L]
Place that code at the top of the wp_config.php file.
Then you fire it up and see what happens. Usually it is the database user name and password that is the problem. Another good site, that covers a lot of this, in much more detail is:
https://wedevs.com/92444/change-wordpress-site-address/
Hope this helps…good luck