If you want to move WordPress website files from domain A (old domain) to domain B (new domain). Or move WordPress-based website files from domain A (old domain) to a subdomain. What must be considered is,
1. File website WordPress
2. MySQL database
Both files must be completely moved and synchronized again so that the website can run properly.
Moving a WordPress Database
1. Login cPanel Hosting
First you login to cPanel.
2. Opening the File Manager
If you have successfully logged in, please type "file manager" in the search field. Click on the File Manager Menu.
3. Searching for the WordPress Database Name
Now, it's time to export your website database so you can import it into another database. Now, because there are too many database names, you need to find the database name first in wp-config.php. If the website is on the main domain, please open the public_html folder If the website is on a subdomain, please open the subdomain folder Then find the wp-config.php file then click View
In wp-config.php, you can see the database name of your WordPress website.
4. Open phpMyAdmin
If so, please return to cPanel and open phpMyadmin. The trick is to type "phpmyadmin" in the search field. Click the phpMyAdmin menu.
5. Export MySQL Database
Please export the database from the website file on the old domain. This aims to move the database from the old domain to the new domain.
Now it's time, create a database for WordPress on the new domain
6. Create a New Database
You can now create a new database for the new domain.
7. Import a .sql file
Log into phpmyadmin again and import the .sql file into the new database. Click the name of the new database then click Import. Then click Choose File and select the .sql file that was exported earlier. Then click Go!
Moving WordPress Website Files
1. Login cPanel Hosting
First you login to cPanel.
2. Opening the File Manager
After successfully logging in, please type "file manager" in the search field. Click on the File Manager menu.
3. Specifying Website Files
Now it's time to decide which website files to move. Whether on the domain or on the subdomain.
If on a domain, the folder that is moved is the public_html folder.If it is on a subdomain, then the folder that is moved is the folder according to the subdomain name.
4. Moving WordPress Files
Next, enter the domain / subdomain folder that you want to move. If on the main domain, please open public_html. Then click Select All. After that click Copy.
Then write the name of the new domain or subdomain folder. Please click Copy File. Wait a moment until the copy process is complete.
5. WordPress Files Moved Successfully
Now try opening the subdomain / domain folder and various WordPress files from the previous domain will appear. Now try opening it in a web browser then write the new domain / subdomain. Did it appear? Not yet! There will be an Error establishing aatabase connection! So now it's time to synchronize the database first.
Synchronize WordPress Files with Database
In order for your WordPress files to be accessible, you must synchronize your database with your wordpress files.
Please open cPanel Hosting. Go to File Manager. Then go to the domain/subdomain that contains the WordPress files. After that, find the wp-config.php file and click Edit. Then customize it with the database name earlier.
Change Domain/Subdomain in Database
In addition, you will also need to synchronize wpna_options or wp_options. Go to phpMyAdmin and select the new database that you imported the .sql file from. Then select wpna_options and see the option_name column for site url and home.
Please click Edit. In the option_value column, please replace it with a new domain/subdomain.
WordPress Files Moved Successfully!
Yeay! Cara memindahkan WordPress ke domain sudah selesai! Sekarang coba buka subdomain/ domain baru di web browser. Voila! Website wordpress kamu telah selesai dipindahkan.