How to Migrate your WordPress Website a New Web Host

Migrating your website can be a daunting task and quite unnerving if you do not know the proper way to do it, although WordPress has a guide it can be confusing to many. Whether you want to move from WordPress.com or you are fed up with your current host and you want to move your website to a new host. WordPress offers much flexibility and you don’t need to reinstall it to migrate your site to another host or web address.

We will explain in this article how you can do that in the easiest possible way without losing your website or any of your data. There are usually three ways in which people do it, either hire a professional to do it for them or look for a host that offers this service in their package or do it themselves. While it may seem like a lot of work, but it can be done easily following the right method and it can be reversed as well if any issues occur.

Moving a WordPress site to a new host

Step 1: Backup your Website

The first and foremost thing that needs to be done before moving your website is to create a backup. It will come handy if something goes wrong in the process, you need to backup every aspect of your site, including the plugins, theme files, media and database as well.

There are many ways in which you can backup your site; there are many plugins available that can backup your entire website. You can also do it manually through an FTP program such as FileZilla, or a third party service like VaultPress. Make sure that you copy hidden files like .htaccess as well before you migrate.

Step 2: Export the WordPress Database

You need to export the WordPress database from your old account if it uses cPanel you can do it by logging into the cPanel account of your web server and access the phpMyAdmin tool available in your cPanel. Select the database for your WordPress website and click on ‘Export’ tab on the navigation menu. Make sure the ‘Quick’ option is selected and you can safely click ‘Go’ to download the database on your computer.

If your website doesn’t use cPanel, you need to contact your hosting provider about the process in which you can export the database. After the FTP files download and the database export, you can now move to the next step.

Step 3: Create WordPress database on the new host server

You need to create a database on the new server before you migrate to the new host, for this you need to create an environment for WordPress installation. Login to your new web host with the credentials provided by them to connect to the cPanel software.

Now in the cPanel, go to MySQL database and create a new database with a proper name for your website. After this you need to create a new MySQL user with a secure password, now you need to add the new user to the database and grant ‘All Privileges’. Make sure you write down the database name, your MySQL account name and password. You will require them in the future.

Step 4: Edit the wp-config.php File

Locate the folder where you have saved your website files, search for the folder file named wp-config.php which controls the access to WordPress and your database. Create a copy of this file and save as wp-config-old.php anywhere on your computer. This is recommended so that if you make a mistake while making changes, you’ll have an old copy to restore.

Now you need to open the original file and make the following changes:

1. You need to change the database name, locate the line define(‘DB_NAME’,’db_name’); and edit the name of your old database in ‘db_name’ by replacing it with the new one you just created.

2. Change the Database Username, locate the line define(‘DB_USER’,’db_user’); and edit your username in ‘db_user’ portion by replacing your new username with the old one.

3. Change the Database User Password, locate the line define(‘DB_PASSWORD’,’db_pass’); and edit your password in ‘db_pass’ portion by inserting the password that you just created.

Save the wp-config.php file and close it.

Step 5: Import your Database

We now have a new database to work upon, you can now import the .SQL file that we exported. You need to open cPanel, launch phpMyAdmin and select your new database. Click on the ‘Import’ tab on the top of the page, now under the ‘files to import’ section select the database that you previously exported.

Now uncheck the partial import box that says “Allow the interruption of an import in case the script detects it is close to the PHP timeout limit” and then select ‘go’ to complete the process. After a while, you’ll get a confirmation message that your files have been successfully imported.

Step 6: Upload WordPress Files to the new host

The next step is to upload WordPress files to your new host, login to the site using an FTP program and browse to the folder where you want your website to be held. Copy your files to the public_html folder if you want your site in the root directory of your site’s domain.

Make sure you don’t delete the files from your computer, we might need it until we finish the entire procedure.

Step 7: Edit Database

To ensure that all the images and posts that are linked to other parts of the site work properly, you need to update your domain name in the database. If you want to search quickly for instances of your old domain and replace it with the new, you can do this with Search Replace DB script. The script will maintain a serialized PHP string while searching and replacing on the new domain.

Upload the script to your site and scan all the tables, insert what you want to find (old domain name) and replace (new domain name).

Step 8: Configure DNS settings

You need to configure your DNS settings to make your site work with your domain name, login to your site hosting your domain and point your correct records to the new web host. This step may vary with every host, contact your web host if you are not sure about the process. DNS can take up to 48 hours to propagate and make sure you do this when you expect low traffic on your site.

Step 9: Final Touches

After 48 hours, you should be able to login to your WordPress and access your new host with the login credentials on your old server. You can keep the backup of the database files and the original wp-config.php file in case you change your mind.

Final Word

Migrating your website is a simple process if you follow the right procedure and make sure you keep the backup until you have migrated successfully. You can keep the files if you need to roll back the migration. Let us know your experience in the comments section if you’ve migrated recently.

Editorial Staff
mail@85ideas.com

Editorial Staff at 85ideas is a team of WordPress experts led by Brian Harris. Here to share amazing tuts, guides and collections.

No Comments

Post A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.