Knowledge Base
 Up to 70% off  on  WordPress  hosting for WordPress Websites and Stores!

Changing the Domain of your WordPress Site

As a business entity, you may want to promote a popular product known by more than one name, and you would like to use separate domains for each product. This is when you may need to duplicate your WordPress site's content and use it on a different domain name.

Instead of designing a new separate site for each domain, you may use the content existing in your current domains. The following guide will assist you in duplicating a WordPress site.

Please be advised that the steps below may not be enough to successfully change your domain due to how WordPress communicates with the server. Before you proceed with the remaining steps in this article, it is recommended that you generate a full backup of your website using the Backup feature of the cPanel.
Important Note:
HostGator is not accepting site clone requests at this time, and the steps below are only recommended if you are fully knowledgeable on how to work around your WordPress files. It is still strongly advised to contact your web developer and have them do this for you instead. The guide below can break your site if incorrectly executed, and HostGator cannot reverse the process for you.

Here are the steps you need to do to change the domain of your WordPress website

Step 1: Copy files to the new domain

Before proceeding to the steps below, ensure your new domain is already added to your cPanel.

To copy website files to your new domain:

  1. Log in to cPanel. There are two ways to access your cPanel.
    • Option 1: Access your cPanel directly.
    • Option 2: Access your cPanel via your Customer Portal.
      1. Log in to your Customer Portal.
      2. Click Hosting in the left-side menu.

        Customer Portal - Hosting menu

      3. If you have a single hosting package in your account, scroll down to the Quick Links section.

        If you have multiple hosting packages in your account, locate the hosting package you want to manage on the Hosting Packages page, then click its Manage button.

        Hosting tab - Manage button

      4. Under the Quick Links section, click the File Manager button.

        Hosting menu - Quick Links - Launch cPanel

  2. Open the public_html (or the domain's document root where the source files come from).
  3. Click Select All found on top of the screen.
  4. Press and hold the Ctrl key while clicking (un-selecting) the following files/folders in your public_html folder:
    • cgi-bin
    • .qidb
    • addon domain directory
  5. With the files still highlighted, click Copy in the top menu of the File Manager. A pop-up will open, showing the file path:
  6. Type the name of the addon domain directory to which you are copying the files. This box should now look similar to:
    Replace "youraddondomain.com" with the actual domain being used.
  7. Click Copy File(s).

If you are unfamiliar with the File Manager and would like to learn more about how to use it, please read:

Step 2: Create a new MySQL database

Once the files have been copied over to your addon domain directory, click the MySQL® Databases icon in the cPanel to create a new MySQL database.

cPanel - MySQL Databases

Step 3: Modify the wp-config.php file for your new WordPress site

To edit the wp-config.php file for WordPress:

  1. Go to your cPanel's File Manager.
  2. Go to public_html to find the wp-config.php file. (If you have other domains, access that domain's document root.).
  3. Right-click on the wp-config.php and click Edit from the options. Alternatively, you can select the wp-config.php file and click Edit in the top menu.

    HostGator File Manager wp-config Edit

  4. A dialogue box may appear asking you about encoding. Just click Edit to continue. The editor will open in a new window.

    HostGator File Manager wp-config Dialogue Box

  5. A new page will open where you need to edit the following information to reflect the values assigned to the new database created in Step 2 ⤴.

    HostGator File Manager wp-config Database

    • DB_NAME
    • DB_USER
  6. Click Save Changes.

Your wp-config.php file should now reflect the correct database name, database user, and database password. This is essential for WordPress to know which database to obtain the information from.

Step 4: Export the database

Export the database from the primary domain and import it into the newly created database. For help with this process, please refer to the following articles:

Step 5: Update the database

The database settings must be updated to reflect the new domain name information.

  1. Look for the Databases section, then click the phpMyAdmin.

    HostGator cPanel phpMyAdmin Icon

  2. On the next page, click on the newly created database name.
  3. Click wp_options.

    HostGator phpMyAdmin wp-options

  4. Click Edit on the site URL and home URL line.

    HostGator phpMyAdmin site url edit

  5. Change the option_value to your new addon domain name or use a temporary URL if your addon domain is not pointed to HostGator yet.

    HostGator phpMyAdmin Option Value

  6. Click Go to save the changes.
  7. Click Edit on the blog name line.
  8. Change the blog name to reflect your new blog.
  9. Click Go.
  10. Click Edit on the blog description line.
  11. Change the blog description to reflect your new blog.
  12. Click Go.
  13. In the left navigation panel, click wp_users.

    phpMyAdmin wp-users

  14. Click Edit on the user_login line, and change the user name to reflect a new login username of your choice.

    phpMyAdmin User Login

  15. On the user_nicename line, change it there as well. For security purposes, do not use Admin as either username.

    phpMyAdmin user_nicename

  16. On the user_pass line, highlight and delete the characters already in that box.

    phpMyAdmin user_pass

  17. Click the down arrow, select MD5, and create the password of your choice.

    phpMyAdmin user_pass

  18. Click Go.
  19. Test these changes by visiting http://youraddondomain.com/wp-login.php (replace youraddondomain.com with your actual domain name).

You should now be able to log in to your newly imported blog.

Step 6: Update the database tables

Once the domain is working, and you can log in to the WordPress Dashboard of the new site, install the Search and Replace plugin. It will allow you to search all the database tables, search for your old domain, and replace each instance with your new domain. You can uninstall the plugin after the tables have been updated.

In addition to the database, you should check your site for links hardcoded into widgets, etc. Those links must be manually edited to reference your new site address.

For additional information on using this plugin, please review the following article:

Step 7: Update WordPress

  1. Log in to your WordPress Dashboard.
  2. In the left navigation menu, go to Settings and click General.

    WordPress Dashboard General Settings

  3. Be sure that each of the following fields displays your new domain name and not the old one:
    • WordPress Address (URL)
    • Site Address (URL)

    WordPress Dashboard General Settings


Did you find this article helpful?

* Your feedback is too short