WordPress is one of the most used CMS in the world, and this is because its one of the most easiest to handle and to work on, with the largest developer community. But on of the most prominent thing faced on WordPress has been to migrate WordPress site from one old Hosting/Server to a New Hosting/Server. It could be because you would have developed the website on a test server as all the websites are done, and now you are trying to migrate WordPress site to the live server, or it might be the case that the you are fed of your old hosting provider (Common we all have been there), and are trying to move to a new hosting provider.
The entire process is quite simple, it might look overwhelming, but trust me its very simple just follow the points one at a time.
- Make a Back up of all the files on your PC.
It’s the easiest step of them all, When you open your cpanel of your hosting account. You will see a icon called File manager, open it on the Root Folder you will see a list of files and folders, Please select all the files and folders in the root directory, and then click on Compress as a Zip, Once the files are compressed then download the zip on your PC.
- Make a Back up of the Database.
On your cpanel where you got the icon for FILE MANAGER, You will see another icon saying PHP MY ADMIN, Please open that, it will open the Mysql of your server, on which all the database is saved, Please click on the DB name of your Website, and Click on Export, It will auto select all the tables in the DB, if it doesn’t then please select all the Tables and Click on GO. It will download the entire DB on your PC as a SQL file.
- Move the Files to your New Server
This is also a very easy step, Open the new server Cpanel and click on the File Manager, Once the file manager is open click on Upload, Select the Zip download that you have, Once the Upload is Complete select the Zip and Extract the file on the root folder.
- Create New DB for the SQL
This again is a simple step, Just next to the icon which says PHP MY ADMIN you will see a icon called DATABASE, Open it, Under this section you will see three main sections, One Create Database, Below that Create User, and the Last one will be Assign User to Database. In the first section enter the name of the Database that you want, and create it, Please save the name of the Database on a Notepad file as it would be required later. Next Create a User, Copy the Username and Password on the same Notepad for later use, Then assign the User to Database from the Third Section, please assign all privileges to the user for this DB.
- Update Wp-Config.php with the latest DB details
Now inside you cpanel, you will see in the root folder a file named wp-config.php, please select the file and click on edit. Once the files open up it will have a lot of codes on it, please look for 4 main things on this file,
1. define(‘DB_NAME’, ‘Enter-Name-of-DB-from-Notepad’);
2. define(‘DB_USER’, ‘ Enter-username-from-Notepad ‘);
3. define(‘DB_PASSWORD’, ‘ Enter-password-from-Notepad ‘);
4. define(‘DB_HOST’, ‘localhost’); Leave it as localhost by default, if your server has a different Host then please enter that host name once you have made the following edits then please click on save.
- Upload the old DB on new Server.
Now open the PHP MY ADMIN on the new server, you will find the new DB already present in it, Please select the DB and then click on Import , Upload the Sql file that you have downloaded , Once the upload is done , the DB is Loaded.
- Update DB with New URL (Only Applicable to People trying to move from test server to liver server or to a new domain)
In the PHP My Admin Section, Open the table named as WP-options, On the First row of this table you will see the old website URL. Please copy it
www.example.com or localhost/mysite/
Save this URL for Later Use.
Now , Download this File from this POST, named Replace-url.php
Once you have the file, please upload the same file to your file-manager root folder, it would be the same folder where you uploaded the wordpress backup zip, Once its Uploaded please visit
Step1: Click on Next
Step2: Select all the Tables and Click Next
Step3: Enter You old website url on the top text box & New website URL in the Bottom text box
- Update Domain Nameserver(Only Applicable to users who are locating their website to a New Domain)
Please check with your new hosting provider to know what is the Nameserver values for your hosting.
Once you have the name server from your hosting provider. Please, go to your domain account manager, and under your domain settings, you will an option of nameserver, it will be filled with something similar to this
please replace this with the new nameserver for your hosting, this takes around four hours to reflect on your domain. So, don’t worry if it does not start showing the website straight away.