How to move your WordPress Blog to a New Host

What if your are not satisfied with your current host? Sometimes you want to migrate your WordPress site a to a better and more reliable host which can be stressful if you don’t have the expertise. You definitely want to make a safe change from an initial to a new host.

Relocating your WordPress site from your current host to a new one can be done in a few steps:

1. Backup your files

The first step is to make a backup of every aspect of your site. Install WP-DB-BACKUP Plugin and backup your data source. You can also use an FTP program like FileZilla to connect to your web host and copy all files under your website’s directory to a folder on your local computer. Depending on the number of media uploads you have in your site, this could take some time.

2. Exporting WordPress database

Exporting WordPress Database

Exporting WordPress Database

Login to the cPanel account of your web server and open the phpMyAdmin application. Select the database that contains your WordPress installation from the list and once selected click on the Export tab on the navigation menu.

The default settings of a Quick export and the SQL format for the export are sufficient for what you need. Click the Go button and the database export process will begin and a file will be downloaded to your local computer.

Once the database export and the FTP transfer of your files have both completed, you are ready to move onto the next step.

3. Create The WordPress Database On New Server

Before you can begin the migration to the new web host, you need to create an environment for a WordPress installation. To do this, you must create a database that you can import your SQL data into.

Login to your new web host with the user credentials they have given you and connect to the cPanel software. For instance, you can use the MySQL Databases application. If your web host doesn’t have that application running then you should contact their support team to discover their method of creating new databases.

For creating a database you need to do the following:

  • Open MySQL Database and create a new database with an appropriate name for your website.
  • Create a new MySQL user (with a secure password).
  • Add this user account to the new database and grant it All Privileges.

Write down the database name, the new MySQL username and its password. You will need them soon.

4. Edit the wp-config.php File

Browse to the folder on your local computer where you downloaded your website files to. In that folder there is a file called wp-config.php that controls the access between WordPress and your database.

Make a copy of this file and store it in another folder on your local computer. This is necessary for restoring the changes we are about to make should something go wrong later.

Open the original version of the file with your favorite text editor and make the following three changes:

Change The Database Name

Locate the following line:

define('DB_NAME', 'db_name');

The db_name portion of this line will currently be set to the MySQL database name of your old web host. This must be changed to the name of the new database you have just created.

Change the Database Username

Below this you will find the line:

define('DB_USER', 'db_user');

In this line you need to change the db_user portion from the username of your old host to match the new username you have just created.

Change The Database User Password

Finally, edit the third line:

define('DB_PASSWORD', 'db_pass');

As with the others, the db_pass section of this line must be changed to the new secure password you created for your MySQL user.

Save wp-config.php and close the file.

5. Import Your Database

Import your database

Import your database

Now that you have a new database to work with we can begin the import process.

Launch phpMyAdmin from the cPanel software on your new server and select your new database from the list on the left hands sidebar. Once it opens select the Import tab from the navigation menu.

In the File to Import section click the Choose File button and select the SQL file you exported previously.

Un-tick the Partial Import check box, make sure the format is set to SQL and then click the Go button. The database import will now begin.

The time this import takes varies depending on the size of your database. You should receive a message informing you of the success of the import when it has finished.

6. Upload WordPress Files To  New Host

Now that you have the new database prepared and you’ve reconfigured the wp-config.php file, it is time to begin uploading your website’s files.

You need to use FTP software to transfer files from your local system to the server. However, sometimes it’s better to use the built-in file manager for cpanel which is definitely easier. You can compress the files into a zip file and upload them and decompress them at the server level.

Locate the folder where all the local files are and select the remote directory where you can upload your website files, that should now include the updated version of wp-config.php. As with the earlier download, this process can take some time. Don’t delete these files from your local computer once the upload finishes. They are still needed until the final steps have been completed.

7. Change the name servers

The final step when you transfer the WordPress site from the old to the new server is to change the name servers. This ensures that your users are taken to the new location of your website. Make sure you are running the search and replace on the new domain you are transferring the site to not the old one.

Modifying the Site URL: By doing a search and replace for the old domain and replacing with the new domain you will also be altering the site_URL and home URL values in the database which will ensure that when you try to log into your site on the new domain it doesn’t try and redirect you over to the old domain.

 

Christine

Christine

Author at onlineshouter
Christine writes for people who seek for knowledge about SEO, blogging, online marketing, gadgets and web apps.
Christine

Leave a Reply

Your email address will not be published.