Moving a Wordpress Site to another Server?





Wordpress



There often comes a situation when we would have to develop a website on our test server and on completion move it to live for a client for review and final testing.

This is such a critical task to safely move all your data to other server without having some technical faults. For that reason here we are going to discuss some very important steps to be followed strictly while making this happen. Here it goes:
Before explaining rest of the steps I would first like to appeal that 'make a backup' of your whole site and database which is highly recommended. You can further get help from Wordpress Codex.
  • Deactivate all the plugins installed in the wordpress.
  • Download whole site including all files and folders on server root directory through a cpanel or a FTP account.
  • Now go to phpMyadmin if you are familiar with, export the particular database to an SQL or Text file and copy it somewhere in your local system.
  • If you can connect through a MySQL Administrator GUI to your database and backup your particular Database Schema to your local system.
  • Open this SQL file in notepad or any text editor and search out your existing server’s domain address like this example.com without www or http:// just use the domain keywords and replace it with new servers address like this newserver.com
  • After replacing all the instances of urls in sql file we need to import it to the new server’s phpMySQL admin. After importing d atabase to new location copy the database name, database user and password in safe place.
  • We are half done with moving site. Now Upload the site backup to new server’s root directory through. 

Configuring and Testing on New Location

The first step on newer server location is to create a database using hosting 'cpanel' that could be different from older location's database. Copy the database name, username and password to somewhere safe place so will be used to be replaced in wp-config.php file.

After uploading the whole website to the root directory of new server location. We have first edit the wp-config.php file for newer server database credentials.
On line number '19 or somewhere near it replace the database name on line:

/** The name of the database for WordPress */
define('DB_NAME', 'db_name');

with the one we have created on new server. and change the database user with the one we have created on the newer server on line:

/** MySQL database username */
define('DB_USER', 'root');

Now we have to change the password as same we did above on line:

/** MySQL database password */
define('DB_PASSWORD', '');

And the hostname will be remain same 'localhost on the line:

/** MySQL hostname */
define('DB_HOST', 'localhost');

Now update this wp-config.php file and upload to server wordpress main directory. And this the time for some testing.

Testing of the Wordpress Dashboard and Website Front


Now we have to test the whole website functionality to be correctly working. That could be in these steps:
  • First test the wordpress dashboard. Login to the site. Go to the 'Settings' menu tab in left menu and the 'General Settings' check the site url is correct as same the newer server.
  • Go to the 'Plugins' tab in left menu. Activate all the plugins and check the website front end of it is working fine as on previous location.
  • Test the theme functioning right and all the posts, categories, comments, tags, pages and styles should be rightly same as the previous site. 

CAUTION

Sometimes by mistake site url creates problem which could possibly cause of SQL file not updated rightly.


Previous Post Next Post