PHPMatters Help You Better Hosting Your PHP-based Sites
How to Move WordPress to Another Host in A Secure Way

How to Move WordPress to Another Host in A Secure Way

Full transfer of WordPress to an entirely new host can be stressful and daunting. Individuals feel the need to move their websites to a new host because of many reasons such as security issues with their present service provider, undesirable hosting performance, the frequent downtime of the website, and many more. However, transferring your WordPress site to a new host can be difficult and tiring, and there is a fear of site damage or losing important data as well.

While many people take the help of professionals for this service, below are easy steps, through which you can transfer your WordPress site to a new host in a secure and hassle-free manner.

Ensure all backup files are Restored and Undamaged

Before processing any changes in your website, it is important to keep a backup for all necessary and supplementary files and data. The full WordPress backups should include your theme data and files, uploads, used plugins as well as your database. Data backup can be done using various tools such as phpMyAdmin, Sequel Pro especially for OS X, terminal commands, MySQL or WP-DB-Backup that offers one extra copy of the database through download or by email.

Export WordPress Database

For this, you need to log into your control panel offered by your web host and find the related tool. Here, we take cPanel as an example. After entering, you can open phpMyAdmin.

The next stage is selecting the database containing WordPress installation and then clicking on the export tab from the navigation menu. After that, you can press ‘Go’ button for starting the process of database export. Some advanced configurations can be made according to this image showed in below.

Export WordPress Database

Transfer WordPress on a New Host

Before installing WordPress in the new hosting provider, it is important to create a supportive environment by choosing a trusted WordPress host. There are a lot of options online, and the following three are the top choices that are used and trusted by a large number of WordPress users.

To better explain the steps, we take HostGator as an example, which is a top-rated WordPress hosting provider on the web. For this, it is essential to create a database that can help in importing the SQL data. After going with this company, you need to login into your account using the credentials supplied by the new host, and then connect with cPanel control panel.

It’s easy and short, and the steps are simple:

  • Open the MySQL database for creating a new one with appropriate website name
  • Provide a secure username and password for the new MySQL
  • Integrate the new user with a new account database and then provide all privileges to it
  • Don’t forget to remember the name of the database, MySQL password and username for future use

Edit wp-conflig.php File

Explore the wp-config.php file in the local computer and create a copy. This file controls the contact between database and WordPress. After making a copy, store it in a different folder. This process is essential for the restoration of the future changes, and it also works as a secure backup step.

After opening the file’s original version, you have to make the below mentioned changes:

  • Changing the name of the database by locating a line given below.
  • change name
    You have to change the name of the newly created database.

  • Changing the username of the database by using the following line.
  • change username
    Here you have to change the old username with a new one just created.

  • Changing the user password of the database. You have to locate and edit the line provided as below.
  • change password
    Close the current file after saving wp-config.php.

Import the Database to A New Host

The import process can begin by launching the phpMyAdmin on the newly established server from cPanel and then selecting a new database. Click to the import tab from the navigation panel. Click the button, choose file and choose the SQL file exported previously. Click Go button to start the import.

Import the Database

Upload Files in The New Host

In this stage, you have to use FTP program to connect with the newly created database. Using the remote directory, you can upload the files in the new website that includes the revised version of wp-config.php. Also, the utilization of File Manager that can be founded in cPanel is appropriate.

Establish New URL and New Domain

A common problem faced by users of WordPress while transferring their domain is the breakage of the chain links when moved to the newly created site or domain. This issue can be resolved using the script Search Replace-DB presented in the IT hub. This script can help in easy and quick search of the old domain links that can be imported. However, make sure that the script is deleted after the use for security purposes.

Search Replace-DB

Final Establishment

Configuring the DNS setting of the new domain can be beneficial in ensuring that IP address has the correct records. It takes almost 48 hours for the new WordPress domain to propagate and fully function. Avoid making any change in the new host site for a smooth transition.