> ## Documentation Index
> Fetch the complete documentation index at: https://kb.hosting.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to migrate an existing WordPress site to hosting.com

> Discover how to seamlessly migrate your WordPress site to hosting.com, ensuring all files, databases, and settings are transferred correctly.

This article describes how to migrate an existing WordPress site to a hosting.com account.

<Note>
  This article describes how to migrate a WordPress site manually. There are also plugins that can help you migrate an existing WordPress site, such as [Duplicator](https://wordpress.org/plugins/duplicator) and [WordPress Move](https://wordpress.org/plugins/wordpress-move), but hosting.com does not provide support for these plugins, and they may not work for all configurations.
</Note>

## Migrating an existing WordPress site to hosting.com

If you already have a WordPress site with another hosting provider and want to move the site to hosting.com, you do not need to install WordPress and start all over. Instead, you can migrate the WordPress site to your Hosting.com account. To ensure the migrated site works correctly, there are five main things to do:

* Migrate the WordPress files, including all application code files, plugins, themes, and configuration files.

* Migrate the WordPress MySQL database.

* Configure any custom settings that are in php.ini or .htaccess files.

* Configure domain settings.

* Test the new site.

The following sections guide you through each of these steps.

### Step 1: Migrate the WordPress files

The first step is to migrate all of the WordPress files from the existing site to your hosting.com account. The easiest way to do this is compress all of the files into a single.zip file that contains the WordPress core application files, configuration files, plugins, and themes.

#### Using cPanel

If your hosting accounts include cPanel, you can use the File Manager to migrate the WordPress files. To do this, follow these steps:

1. To compress the WordPress files into a .zip file:

   * Log in to cPanel on the account that hosts the existing WordPress site.

   * In the **Files** section of the cPanel home screen, click **File Manager**.

   * In the **Directory Selection** dialog box, select **Home Directory**, confirm that the **Show Hidden Files** check box is selected, and then click **Go**.

   * In the File Manager's main pane, right-click the **public\_html** directory, and then click **Compress**.
     > 📘 Note
     >
     > If WordPress is not installed in the **public\_html** directory, go to the directory that contains the WordPress files instead.

   * In the **Compress** dialog box, select **Zip Archive**, and then click **Compress File(s)**.

   * After the File Manager finishes compressing the directory into the *public\_html.zip* file, click **Close**.

2. Use the [cPanel File Manager](/docs/upload-and-download-files) or [FTP](/docs/using-ftp-file-transfer-protocol) to upload the *public\_html.zip* file to the home directory on your hosting.com account.

3. To extract the WordPress files from the *public\_html.zip* file:

   * Log in to cPanel on your hosting.com account.

   * In the **Files** section of the cPanel home screen, click **File Manager**.

   * In the **Directory Selection** dialog box, select **Home Directory**, confirm that the **Show Hidden Files** check box is selected, and then click **Go**.

   * In the File Manager's main pane, right-click the **public\_html.zip** file, and then click **Extract**.

   * In the **Extract** dialog box, click **Extract File(s)**.

   * After the File Manager finishes extracting the files, click **Close**.

4. The core WordPress files are now in the *public\_html* directory. The next step is to migrate the WordPress database. Please see **Step 2: Migrate the WordPress MySQL database** below.

#### Using the command line

If your hosting accounts do not include cPanel, you can use the command line interface to migrate the WordPress files instead. To do this, follow these steps:

1. Use SSH to log in to the account that hosts the existing WordPress site, and then type the following commands:

   ```bash theme={null}
   cd ~
   zip -r public_html.zip public_html
   ```

   > 📘 Note
   >
   > These commands assume that WordPress is installed in the *public\_html* directory. If WordPress is installed in a different directory, use that directory in the **zip** command instead.

2. Use [FTP](/docs/using-ftp-file-transfer-protocol) to upload the *public\_html.zip* file to the home directory on your hosting.com account.

3. To extract the files from the *public\_html.zip* file, log in to your hosting.com account using SSH, and then type the following commands:

   ```bash theme={null}
   cd ~
   unzip public_html.zip
   ```

   > 📘 Note
   >
   > These commands assume that WordPress will be configured in the *public\_html* directory. If you used another directory in step 1 to create the .zip file, use that directory instead.

4. The core WordPress files are now in the *public\_html* directory. The next step is to migrate the WordPress database. Please see **Step 2: Migrate the WordPress MySQL database** below.

### Step 2: Migrate the WordPress MySQL database

After you migrate the WordPress files, you are ready to migrate the WordPress MySQL database.

#### Using cPanel

If your hosting accounts include cPanel, you can use phpMyAdmin to migrate the MySQL database. To do this, follow these steps:

1. On the existing WordPress site, make sure you have the correct name of the WordPress database. To do this, open the *wp-config.php* file in a text editor, and look for the line that starts with **define('DB\_NAME'** . This setting defines the MySQL database that WordPress uses.

2. To export the MySQL database:

   * Log in to cPanel on the account that hosts the existing WordPress site.

   * In the **Databases** section of the cPanel home screen, click **phpMyAdmin**.

   * In the left pane of phpMyAdmin, click the name of the database that you obtained from the *wp-config.php* file in step 1.

   * On the top menu bar, click **Export**.

   * Under **Export Method** select **Quick**, in the **Format** list box select **SQL**, and then click **Go**.

   * In the **Save File** dialog box, type `wordpress.sql` for the filename, and then save the file on your local computer.

3. Use the [cPanel File Manager](/docs/upload-and-download-files) or [FTP](/docs/using-ftp-file-transfer-protocol) to upload the *wordpress.sql* file to the home directory on your hosting.com account.

4. To create a new MySQL database for the migrated WordPress site:

   * Log in to cPanel on your hosting.com account.

   * In the **Databases** section of the cPanel home screen, click **Manage My Databases**.

   * Under **Create New Database**, type a name for the new database in the **New Database** text box, and then click **Create Database**.

   * Click **Go Back**.

   * Under **Add User To Database**, select a user in the **User** list box, and then in the **Database** list box, select the name of the database you created.

   * Click **Add**.

5. To import the MySQL data into the new database:

   * Log in to cPanel on your hosting.com account.

   * In the **Databases** section of the cPanel home screen, click **phpMyAdmin**.

   * In the left pane of phpMyAdmin, click the name of the database that you created in step 4.

   * On the top menu bar, click **Import**.

   * Under **File to Import**, click **Browse**.

   * Select the *wordpress.sql* file that you uploaded in step 3, and then click **Open**.

   * Click **Go**. phpMyAdmin imports the data into the database.

6. Open the *public\_html/wp-config.php* file in a text editor, and then update the following settings:

   ```
   define('DB_NAME', 'database_name');
   define('DB_USER', 'database_user');
   define('DB_PASSWORD', 'database_password');
   ```

   Replace ***database\_name*** with the name of the new database, ***database\_user*** with the database username, and ***database\_password*** with the database user's password.

7. The database is now ready for WordPress to use. The next step is to configure custom settings. Please see **Step 3: Configure custom settings** below.

#### Using the command line

If your hosting accounts do not include cPanel, you can use the command line interface to migrate the MySQL database. To do this, follow these steps:

1. On the existing WordPress site, make sure you have the correct name of the WordPress database. To do this, open the *wp-config.php* file in a text editor, and look for the line that starts with **define('DB\_NAME'** . This setting defines the MySQL database that WordPress uses.

2. To export the MySQL database, use SSH to log in to the account that hosts the existing WordPress site, and then type the following command. Replace ***USERNAME*** with your account username, and replace ***DBNAME*** with the name of the WordPress database that you obtained from the *wp-config.php* file in step 1:

   ```bash theme={null}
   mysqldump --routines -u USERNAME -p DBNAME > wordpress.sql
   ```

3. Use [FTP](/docs/using-ftp-file-transfer-protocol) to upload the *wordpress.sql* file to the home directory on your hosting.com account.

4. To create a new MySQL database for the new WordPress site, log in to your hosting.com account using SSH, and then type the following command. Replace ***USERNAME*** with the MySQL username, and replace ***NEW\_DBNAME*** with the name of the new WordPress database that you want to create:

   ```bash theme={null}
   mysql -u USERNAME -p -e "CREATE DATABASE NEW_DBNAME"
   ```

5. To import the MySQL data into the new database, type the following command. Replace ***USERNAME*** with the MySQL username, and replace ***NEW\_DBNAME*** with the name of the MySQL database that you created in step 4:

   ```bash theme={null}
   mysql -u USERNAME -p NEW_DBNAME < wordpress.sql
   ```

6. Open the *public\_html/wp-config.php* file in a text editor, and then update the following settings:

   ```
   define('DB_NAME', 'database_name');
   define('DB_USER', 'database_user');
   define('DB_PASSWORD', 'database_password');
   ```

   Replace ***database\_name*** with the name of the new database you created in step 4, ***database\_user*** with the database username, and ***database\_password*** with the database user's password.

7. The database is now ready for WordPress to use. The next step is to configure custom settings. Please see **Step 3: Configure custom settings** below.

### Step 3: Configure custom settings

You may have custom settings for your WordPress site in one or both of the following files:

* *php.ini*

* *.htaccess*

If you have either of these files on your account that hosts the existing site, review them to determine if you need to migrate any of the settings to your hosting.com account. If you do, you can either copy the entire file or files, or selectively add settings.

### Step 4: Configure domain settings

The next step is to configure your domain settings. The steps required depend on your migration scenario:

* If you are migrating from another hosting provider to hosting.com and want to use the **same** domain name, you must configure the domain's name server settings to point to the Hosting.com server that hosts your account. You do not need to change any domain settings in WordPress.
  > 📘 Note
  >
  > For information about how to set a domain's name servers to point to hosting.com, please see [this article](/docs/setting-the-name-servers-dns-for-a-domain).

* If you are migrating from another hosting provider to hosting.com and want to use a **different** domain name, you must configure the domain's name server settings to point to the hosting.com server that hosts your account.
  > 📘 Note
  >
  > For information about how to set a domain's name servers to point to hosting.com, please see [this article](/docs/setting-the-name-servers-dns-for-a-domain).

**Additionally** , you must manually update the WordPress database to use the new domain name. To do this, follow these steps if your hosting account includes cPanel:

1. Log in to cPanel on your hosting.com account.

2. In the **Databases** section of the cPanel home screen, click **phpMyAdmin**.

3. In the left-hand pane of phpMyAdmin, click the name of the WordPress database. A list of tables in the database appears.

4. Under the **Table** heading, click the **wp\_options** table. A list of data rows appears.

5. Under the **option\_name** heading, locate **siteurl**, and then click **Edit**.

6. In the **option\_value** text box, replace the current URL with the new domain name that you want to use.
   > 🚧 Important
   >
   > * Make sure you type the correct URL for the domain name, or your WordPress site will be inaccessible.
   >
   > * Make sure the URL begins with *http\://*.
   >
   > * Make sure the URL does **not** end with a forward slash ( **/** ).

7. Click **Go**. phpMyAdmin saves the changes in the table.

8. Under the **option\_name** heading, locate **home**, and then click **Edit**.

   > 📘 Note
   >
   > You may have to scroll through more than one page of data in the **wp\_options** table to locate the **home** row. To do this, click the **>** icon, or you can click **Show all** to view all of the table's rows at once.

9. In the **option\_value** text box, replace the current URL with the new domain name that you want to use.

   > 🚧 Important
   >
   > * As above, make sure you type the correct URL, or your WordPress site will be inaccessible.
   >
   > * Make sure the URL begins with http\://.
   >
   > * Make sure the URL does **not** end with a forward slash ( **/** ).

10. Click **Go**. phpMyAdmin saves the changes in the table. The migrated WordPress site should now function correctly using the new domain name.

Alternatively, if your hosting account does not include cPanel, use the command line interface to update the WordPress database with the correct domain name. To do this, follow these steps:

1. Log in to your hosting.com account using SSH, and then type the following commands. Replace ***USERNAME*** with the MySQL username, replace ***NEW\_DBNAME*** with the name of the MySQL database, and replace ***example.com*** with the new domain name that you want to use:

   ```bash theme={null}
   mysql -u USERNAME -p NEW_DBNAME -e "UPDATE wp_options SET option_value = 'http://www.example.com' WHERE option_name = 'siteurl';"
   mysql -u USERNAME -p NEW_DBNAME -e "UPDATE wp_options SET option_value = 'http://www.example.com' WHERE option_name = 'home';"
   ```

   > 📘 Note
   >
   > If you migrated WordPress to a subdirectory, include it in the URL as well. For example, if you migrated WordPress to the *public\_html/wordpress* directory, the URL would be *[http://www.example.com/wordpress](http://www.example.com/wordpress)*, where *example.com* represents your domain name.

2. To verify that the new domain settings are in the WordPress database, type the following commands. Replace ***USERNAME*** with the MySQL username, and replace ***NEW\_DBNAME*** with the name of the MySQL database:

   ```bash theme={null}
   mysql -u USERNAME -p NEW_DBNAME -e "SELECT * FROM wp_options WHERE option_name = 'siteurl';"
   mysql -u USERNAME -p NEW_DBNAME -e "SELECT * FROM wp_options WHERE option_name = 'home';"
   ```

### Step 5: Test the new site

Lastly, you should test the newly migrated WordPress site on your hosting.com account to ensure that it works. Specifically, at a minimum you should test the following:

* Make sure the site appears at *[http://www.example.com](http://www.example.com)*, where *example.com* represents your domain name.

* Make sure posts and other pages appear correctly.

* Make sure you can log in as the administrator. If you need to reset the WordPress administrator password, please see [this article](/docs/resetting-the-wordpress-administrator-password).

<Tip>
  After you complete the migration, you may want to consider adding the following features to your WordPress site to help improve performance and security:

  * CAPTCHA protection can help protect your site from spamming by bots and other malicious actors. For information about how to set up CAPTCHA protection for your WordPress site, please see [this article](/docs/adding-captcha-protection-to-a-wordpress-site).

  * Caching can dramatically improve your WordPress site's performance. For information about how to configure caching, please see [this article](/docs/using-w3-total-cache-and-gtmetrix-to-optimize-wordpress).
</Tip>
