WordPress is most popular CMS. It provides lots of features when it is self-hosted. If you have running WordPress blog and wants to migrate from old host provider to the new host provider. Then this tutorial is for you because here I am going to share a trick to migrate WordPress blog with almost zero downtime. Isn’t it cool??
During startup, you go with a starter plan or a shared hosting plans to start a new blog. But eventually, when your blog gets more traffic, you start facing some server issue like down time. So, this is the time you have to move on Virtual Private Server (VPS) or a dedicated server. During migration, you have to move all the files from old server to the new server.
Migrating your blog from old host to new one is quite tricky. There are some risks during migration: You may –
- Break your blog.
- Face downtime.
- Loses your data.
DNS resolution takes almost 24 hours to propagate successfully. So, I would advise you to migrate WordPress blog during the time you get low traffic such as night time.
After migration, you may face some minor issues regarding with speed or optimization. So choose a free day so that you can fix them.
So, all set ??
Let’s start with the migration process,
You have to work on both host services so keep both host info while working on. Open your current WordPress dashboard and delete –
- Unnecessary data.
- Remove cache plugin and delete cache directory.
- All backups.
- Inactive themes, plugins if any.
- Spam comments.
- Unnecessary media stuff. Follow our guide to Delete Multiple Images in WordPress Media Gallery.
Deleting unwanted stuff will reduce the size of both database and the wp-uploads directory. And hence you can save some minutes while downloading a backup from the old host.
Download wp-content directory from old host
- Use Filezilla (a free FTP Client) and connect your website.
- Now make a backup of wp-contents directory. (Download entire directory)
You can use a File manager from Host’s cPanel to do so. One benefit of using cPanel here is you can compress the wp-content folder and download it. Follow steps to download using cPanel:
- Log into the cPanel and Go to File Manager
- Click public_html and select your website directory
- Choose wp-contents folder, right click and select compress
- Once the compressed file created, you can download it.
It may take a long time depending on the size of your wp-contents directory. So have some patience.
Take database backup from host’s cPanel
To take database backup follow steps:
- In cPanel go to phpMyAdmin.
- Select your database and click Export.
- Choose SQL Format and click Go button.
- Refer screenshot below.
You can also take database backup using backup wizard located in cPanel.
Once you done with the above steps, move to the new host.
Install WordPress on new host
Log into the new host’s cPanel and install WordPress using installer tool. For step by step guide use our tutorial How to install WordPress from Cpanel.
Upload wp-content directory on new host
Now, upload wp-contents directory to the new host. Use FTP Client (FileZilla) to upload wp-content folder.
If you are uploading compressed wp-content folder then don’t forget to extract it.
To extract you have to open File Manager from cPanel and navigate top compressed wp-content folder >> right click and extract.
Make sure all the files and folder are properly uploaded on the new host.
Create Database on New Host
Now you have to create a database on your new host. For that follow steps:
DON’T FORGET TO COPY AND PASTE YOUR DATABASE NAME, USERNAME AND PASSWORD ON STICKY NOTE OR SOMEWHERE ON NOTEPAD.
- Log into your new host’s cPanel.
- Go to MySQL Database Wizard.
- Input required name for your database and click Next Step button.
- Now input username and choose password (use password generator button to use Very strong password).
- Click Create User button.
- Now you have to add a user to database check the ALL PRIVILEGES check box and click Next Step.
Here you all set to upload database backup on your new host.
Upload Database to new host
To upload database on new host you have to follow these steps:
- Log into your new host’s cPanel
- Go to phpMyAdmin
- Choose the database which you have created earlier
- Click Import >> Choose downloaded database backup file (.SQL file format) and click Go button.
Refer below screenshot
After importing click on structure option in top Navigation and note down table prefix.
Till now you have noted following things for your database:
- Table prefix
Edit wp-config.php file
Now, you have to edit existing wp-config.php file on your new WordPress installation.
- Go to new host’s cPanel.
- Select File Manager.
- Select your WordPress directory.
- Navigate to wp-config.php file.
- Right, click and choose Code Edit.
- Now add all the noted values in the wp-config file.
- Save it.
That’s it, you are done with almost 98% migration.
Migrate WordPress by changing Nameservers
Now you have to point DNS Nameservers to your new host. This will completely migrate WordPress blog to new host. Before that check all the things to make sure you didn’t miss anything.
To change nameservers choose low traffic duration of your site as I said earlier, it takes 24 hours to propagate.
- Download wp-content directory from old host
- Take database backup from host’s cPanel
- Install WordPress on new host
- Upload wp-content directory on new host
- Create Database on New Host
- Upload Database to new host
- Edit wp-config.php file
- Update Nameserver to point to new hosting
So, this is how you can easily migrate your existing WordPress blog to the new host. I hope this tutorial will help you to migrate WordPress blog with zero downtime, but if you stuck anywhere just drop a comment for help.