How to Change the Domain of a WordPress Site

To move a WordPress site from one domain to another, use the following steps:

  1. In this example, we are changing the domain of a WordPress site from example.net to example.com.

  2. Make a backup of the existing WordPress site for example.net using Softaculous in cPanel, and wait for the process to complete.

  3. Using an FTP app or the File Manager in cPanel, open the public_html folder and rename the folder example.com to example.com.backup, then rename the folder example.net to example.com.

  4. Open the wp-config.php file in the example.com folder and make a note of the name of the database.

  5. Visit phpMyAdmin in your hosting account’s cPanel.

    Your cPanel access details are listed on the hosting account’s Info page in the Client Lounge.

  6. In the left column, select the name of your WordPress site’s database.

  7. Select the SQL tab at the top.

  8. Run the following SQL statements (replace all instances of example.net with your old domain, and example.com with your new domain):

    UPDATE wp_commentmeta SET meta_value = REPLACE(meta_value, "example.net", "example.com");
    
    UPDATE wp_comments SET comment_author_url = REPLACE(comment_author_url, "example.net", "example.com");
    
    UPDATE wp_comments SET comment_content = REPLACE(comment_content, "example.net", "example.com");
    
    UPDATE wp_links SET link_description = REPLACE(link_description, "example.net", "example.com");
    
    UPDATE wp_links SET link_url = REPLACE(link_url, "example.net", "example.com");
    
    UPDATE wp_options SET option_value = REPLACE(option_value, "example.net", "example.com");
    
    UPDATE wp_postmeta SET meta_value = REPLACE(meta_value, "example.net", "example.com");
    
    UPDATE wp_posts SET guid = REPLACE(guid, "example.net", "example.com");
    
    UPDATE wp_posts SET pinged = REPLACE(pinged, "example.net", "example.com");
    
    UPDATE wp_posts SET post_content = REPLACE(post_content, "example.net", "example.com");
    
    UPDATE wp_posts SET post_title = REPLACE(post_title, "example.net", "example.com");
    
    UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, "example.net", "example.com");
    
    UPDATE wp_term_taxonomy SET description = REPLACE(description, "example.net", "example.com");
    
    UPDATE wp_usermeta SET meta_value = REPLACE(meta_value, "example.net", "example.com");
    
    UPDATE wp_users SET user_url = REPLACE(user_url, "example.net", "example.com");
    
  9. Edit the site listing in Softaculous and change the old domain to the new one.

  10. Visit your new domain in a web browser to confirm that your WordPress site is working correctly.

Your WordPress site should now be accessible via its new domain!

Should you have any questions or run into any issues, please feel free to open a Client Care ticket via the Client Lounge.


You may also like:


Love our guides? HostM offers professional and helpful WordPress Hosting services with unlimited features and renewal rates that actually match our advertised rates.