Your domain name reflects your business identity in the online world. However, it may so happen that you need to change your domain name or you may need to duplicate the content of your WordPress site and use it on a different domain name. Maybe you are promoting a product that is known by more than one name, and you would like to have separate domains for each product name.

There are several reasons why you want to change your website’s domain name. One way is to create a new site with a new domain name, although it may seem like the best option, it is not a feasible option owing to the time and resource investment required. Instead of designing a new site for each and every domain, you may choose to use the content that already exists on one of your current domains. 

This tutorial will help you understand how to change domain name in WordPress in 7 easy steps.

Note: Please note that the following the steps below may/may not be enough to successfully change your domain due to the way WordPress communicates with the server. For this reason, it is recommended that you take a full backup of your website using the Backups button in cPanel before proceeding with the remaining steps in this article.

Once you’ve taken the backup of your website it is time to start changing your domain name in WordPress.

Steps to Change Domain name in WordPress

Step 1: Copy Files to the New Domain

First and foremost, you need to add a new domain name. To add a new domain, go to cPanel > Addon Domains; then follow the steps mentioned below to copy files to your new domain.

  1. From the cPanel homepage, open File Manager
  2. Open the public_html folder
  3. Along the top of the screen, click Select all
  4. Press and hold the Ctrl key while clicking (un-selecting) the following folders in your public_html folder:
    1. .qidb
    2. cgi-bin
    3. addon domain folder
  5. With the files still highlighted, click Copy in the top menu of the File Manager. A pop-up will open showing the following path: /public_html
  6. Type the name of the addon domain folder to which you are copying the files. This box should now look similar to: /public_html/addondomainname.com
    (Replace addondomainname.com with the actual domain.)
  7. Click Copy File(s)

Step 2: Create a New MySQL Database

Now, that the files have been copied over to your addon domain folder, in another screen, open the MySQL Database Wizard in cPanel. Here you will need to create a new MySQL database. (MySQL is a popular database choice).

Step 3: Edit the WordPress .config File for your New Site

Next, you need to edit the .config file. To edit the wp-config.php file for WordPress, follow these instructions:

  1. In cPanel, go to File Manager
  2. Open the public_html folder and locate your addon domain folder
  3. Right-click on the wp-config.php file and click Code Edit
  4. When this page opens, edit the following information to reflect the values that were assigned to the new database that was created in the previous step
    1. DB_NAME
    2. DB_USER
    3. DB_PASSWORD
  5. Click Save Changes

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

Step 4: Export the Database

The next step is to export the database from the primary domain and import it into the newly created database. To export/import your database, follow the steps linked in the respective articles. 

Step 5: Update the Database

Next, you need to update the database settings to reflect the new domain name information.

  1. Go into cPanel, and click on the phpMyAdmin icon
  2. In the left navigation panel, click on the newly created database name
  3. In the left navigation panel, click wp_options
  4. Click Edit on the siteurl line
  5. Change the primary domain name to the addon domain name
  6. Click Go
  7. Click Edit on the blogname line
  8. Change the blog name to reflect your new blog, and click Go
  9. Click Edit on the blogdescription line
  10. Change the blog description to reflect your new blog, and click Go
  11. In the left navigation panel, click wp_users
  12. Click Edit on theuser_login line and change the user name to reflect a new login username of your choice
  13. On the user_nicename line, change it there as well. For security purposes, do not use Admin as either username
  14. On the user_pass line, highlight and delete the characters already in that box
  15. Create a new password of your choice
  16. To the left of that is the varchar(64) box; click the down arrow and select MD5
  17. Click Go

To test these changes please visit http://yourblogname.com/wp-login.php (replace yourblogname.com with your actual domain name).

You should now be able to successfully log in to your newly imported WordPress site.

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. This will help you to easily search all of the tables in the database, 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 also check your website for any links hard-coded into widgets, etc. If there are any links, then they will need to be manually edited to reference your new site address. 

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

Step 7: Update WordPress

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

Make sure that each of the following fields displays your new domain name and not the old one:

  • WordPress Address (URL)
  • Site Address (URL)

Changing your domain name in WordPress might seem like a daunting process, however, it is simple. All you need to do is carefully follow the steps on your Bluehost dashboard. 

Author

H. Fatima used to be an Engineer by profession and Writer by passion until she started pursuing full-time digital marketing. She is presently a Content Marketeer at Newfold Digital (APAC). She mostly writes what she deeply perceives and analyses, it is her way of unwinding. Her interests include writing, reading, watching foreign-language cinema and public speaking.

Write A Comment