Buy SEOPress Pro

WordPress website migration from one server to other


Do you want to migrate your WordPress base website from one server to other? If so, you are on right article. Today we will write step by step process to migrate WordPress website.

You may migrate your WordPress base website from localhost to live server or live server to live server. Also you can change your domain name.

There are many reasons to migrate WordPress website such as your web hosting provider do not provide you good service etc.

 

WordPress website migration from one server to other

 

Step 1: Save all WordPress files and database in separate zip file.

First thing first. You need to create full backup of your existing website including database. And then store it in your storage device.

We will use this backup to upload files and database on new server. So we will recommend to create a zip file of all WordPress file and database.

If you are using cPanel then go in WordPress root directory (public_html) and then select all files and folder. Now click on compress and select zip and save it. Now you can download it in your computer.

Below is a image that contain all files and folder of WordPress root directory.

 

Wordpress all files and directory

 

Now we need zip file of database. So open PhpMyAdmin and select database which is using for WordPress website. Now click on export and choose custom button. Now choose zip compression and save on your computer.

If you are confused then below image can help you.

 

WordPress database export

 

Now you have backup of your existing WordPress website.

Step 2: Creating new database in new server.

Now you need to setup new web hosting. So i hope that you have configured Name Server and your domain is pointing to new server.

Now you have to create a database in new server. And then you can create a new user and assign all permission to new created database. You must save database name, database user name and password. These will use in WordPress wp-config.php file.

I hope that database and root directory is ready for upload backup files and database file.

Step 3: Uploading all WordPress files in Root directory and updating wp-config.php file.

Now first we will upload all files on root directory of new hosting. So You can open cPanel and go in root directory. it is usually public_html.

Now you can click on upload button and select zip file. This zip file is containing all files and directory of WordPress root directory instead database zip file.

Now you can select this zip file and click on extract. Now we have all files and directory in root directory of new server.

Now you can locate a file call wp-config.php in root directory.This file contain database host name, database name, database user name and user password. So we need to update them.

You have saved database name, database user name and user password when we created database in new server. So now can click on wp-config.php file and press edit or code editor button.

define(‘DB_NAME’, ‘write database name’);
define(‘DB_USER’, ‘write database user name’);
define(‘DB_PASSWORD’, ‘write database user password’);
define(‘DB_HOST’, ‘localhost’); // you can leave it.

Now we have done everything in root directory of new server. Now we do not need to change anything here.

Step 4: Importing old database file in new database.

Let we come back on new database. You can open phpMyAdmin using cPanel. Now you can select new created database. Now you can click on import button. You can locate it in top menu.

Now you need to select a database file. we created zip file of database in step 1. We will use it now. So you need to select zip file of database instead zip file of root contain. And then you can press import submit button.

If you have not changed domain name then you do not need to do anything. You have successfully migrated your WordPress website on new server.

If you want to change domain name then you need to follow next steps.

Step 5: Only if you want to change domain name.

Now you need to update domain name in two table of database.

First you can click on a table call wp_options. wp_ may be different name. It is actually table prefix you choose. So it will like xx_options. You do not need to worry. Just you can select _options.

Now you will see a row with text site siteurl. And after that you will see your old domain name. You need to change this domain name with new one. Suppose it is http://old-domain.com then you can just change to http://new-domain.com only. Keep in mind that do not add / in last of domain name.

You can take advantage of below image.

 

change domain name in options table

 

Step 6: Only if you want to change domain name. This will fix broken links.

Now you can click on wp_posts table. And then you can click on SQL. You can locate SQL in top menu after Structure.

You will see a text area. Here we need to past below sql query and press GO.

But first you need to update two things in below SQL query. First you can change www.old-domain.com with your old domain name and similarly www.new-domain.com with new name of domain. Keep / as it is.

UPDATE wp_posts SET post_content = REPLACE(post_content, ‘www.old-domain.com/’, ‘www.new-domain.com/’);

 

You can take advantage of below image.

 

run sql query in posts table

 

Now you can click  on GO button.

Now you can open WordPress Dashboard. Now you can click on Settings>Permalink and press save changes two times.

That’s all you have also changed domain name.

Have any Question or Comment?

Leave a Reply

Your email address will not be published. Required fields are marked *

Article Categories

.