Most people find it quite stressful to move a WordPress website to another host. But WordPress website migration can be simple and stress-free if you perform it carefully and follow the correct approach.
Here we have described the most common method of WordPress migration using the FTP.
1. Backup your WordPress Website:
- To be safer, take a complete backup of your WordPress website before making any changes.
- Now, copy all your WordPress files, including .htaccess, to your local computer through FTP or cPanel.
2. Export Database:
- Log in to your cPanel and go to phpMyAdmin.
- Select the database you have been using for the WordPress website.
- Then, click on Export at the top of the page.
- Keep the default Quick option and press Go to download the backup of the database to your local computer.
3. Create a WordPress Database at a New Host:
- At cPanel, go to MySQL Database.
- Create a new MySQL Database.
- Create a new MySQL User.
- Add the User to the database and grant All Privileges.
- Keep these database details handy; you will need to replace them in the wp-config file soon.
4. Edit wp-config.php for the Newly Created Database:
- Now, browse the folder where you downloaded your WordPress website files and locate the file called wp-config.php.
- Before you edit the wp-config.php, please keep its copy as a backup.
- Replace the database login details (you just created in the above step) in the wp-config.php file.
- Update the following lines with database, username, and password –
5. Import Database:
- Open phpMyAdmin and select the newly created WordPress database.
- Click on the Import tab at the top of the page.
- Under the File to Import option, select the database file that we exported earlier.
- Under the Partial Import option, uncheck the option 'Allow the interruption of an import if the script detects it is close to the PHP timeout limit.'
- Click on Go.
6. Upload WordPress File to a New Host:
- Copy your WordPress website files using FTP at the new WebHost in the root directory(public_html).
7. Edit database (Edit Site URL):
- After the migration, you will need to update your domain name database to make images and posts linking work appropriately.
Simply opening the WordPress database and updating it will not work as it may break any serialized data.
- You will need a script that will preserve serialized PHP strings when performing a search and replace.
- You need to upload this script to your website, scan all the tables and then input what you want to find (your old domain name) and replace (your new domain name).
Configure DNS Setting:
Once everything is set, change the WordPress website's nameservers (or A records) to point it to a new web host.
After almost 48 hours of propagation, your WordPress site will be up and running.