Suppose you have a WordPress site and you want to transfer it to another server but don’t know how to do it. Here’s how to migrate your WordPress installation to another host or server in six simple easy steps (or less):
1. Create a backup of your WordPress files and database. Keep a copy of these in case you mess up.
2. Copy your WordPress files to your new server. Duplicate all the files from the root folder of your old WordPress website to your new server.
3. This step is applicable only if you are changing the domain name. Login to your website in the old server, go to Settings>General and edit the fields WordPress address (URL) and Site address (URL). Replace it with the new web address the new server has. There might be instances that you want to retain your domain despite the new host/server. In this case you have to add or park the domain in your hosting control panel to redirect it to the new server.
4. Create a database in the new server and export the data from the old one. Go to your old server’s phpMyAdmin and use its handy Export tool to create a script of your WordPress database. In your new server’s phpMyAdmin, Import said script to the new database.
5. In the root folder of your WordPress website in the new server, update the file wp-config.php. In this file are the database constants of your WordPress website. Make sure that the database name DB_NAME, database username DB_USER, database password DB_PASSWORD, and database hostname DB_HOST corresponds to your new server.
6. This step is applicable only if you are changing the domain name. Login to your website in the new server, and install Search and Replace plugin (if you don’t have one). Search the database for instances of your old domain name and replace it with the new one. This step is to rectify all other traces of your old domain name in saved paths in your database especially for uploaded images. Without going over this step your image paths would probably be broken; however if you are using the same domain then there wouldn’t be any problem.
And you’re done! Happy WordPress is happy.