Migration of your WordPress website to a new host is not a complex task if performed properly.
The risks involved in the migration process are data loss and potential downtime which can be eliminated if the steps are followed correctly.
Given below are the steps to migrate WordPress websites to a new host:
Step 1: Back up files
Take a backup of all your files as it is a requirement for your WordPress installation.
You can use FileZilla program to connect to your web host and copy all files to a folder on your local computer.
Step 2: Export WordPress Database
Login to the cPanel account of your web server and open the phpMyAdmin application. From the databases list on the left sidebar, select the database that includes your WordPress installation. Then, click the Export tab on the navigation menu.
Next, click the Go button and the database export process starts and then a file will be downloaded to your local computer.
Step 3: Create WordPress database on new host server
To connect with cPanel software you have to login in with the new credentials on a new web host.
Given below are the steps to create a database:
- Open MySQL Database and create a new database with a name for your website.
- Create a new MySQL user.
- Add this user account to the new database and grant All Privileges.
Note down the database name, the new MySQL username, and password.
Step 4: Edit wp-config.php file
You need to go to the folder on your local computer where the website files are downloaded. There is a file called wp-config.php in that folder that controls the access between WordPress and your database.
To restore the changes you are about to make it is best to take a copy of the file and store it in another folder on your local computer.
Now, open the original version of the file with a text editor and implement the following changes:
- Find the line: define(‘DB_NAME’, ‘db_name’); and change the db_name to the name of the new database you have created.
- Find the line: define(‘DB_USER’, ‘db_user’); and change the db_user part from the username of old host to the new username you have created.
- Find the line: define(‘DB_PASSWORD’, ‘db_pass’); and change the db_pass to the new password you have created.
Save and close the wp-config.php file.
Step 5: Import database
You need to start the phpMyAdmin from the cPanel software on the new server and select your new database from the list on the left-hand sidebar. After it opens, select Import tab from the menu.
In the File to Import section, click Choose File button and select the SQL file you exported previously.
Un-check the Partial Import check box, ensure the format is SQL and then click Go button. The database import begins.
You will get a message after the import has finished.
Step 6: Upload WordPress Files to new host
You need to connect to your new web host using your FTP program and go to the folder that your website is going to be held.
If this is the only site being installed on this web server then upload the files to the public_html folder directory.
If remote directory is selected, you can upload the files that include the updated version of wp-config.php
Step 7: Update domain nameservers
You need to switch your DNS nameservers ensuring that users are taken to the new location of your website when they type your domain into their browsers.
If you have used a domain registrar like Namecheap then you need to find your new web host’s nameservers and update it as per the instructions.
These are the steps that will help you to move WordPress to your new host with no downtime whatsoever. However, if you still face problem in moving WordPress to a new host or server you can get started with our WordPress services.