Changing the Domain of your WordPress Site Print

  • Updated on 01-Jun-2024
  • 19

Changing the Domain of Your WordPress Site

Changing the domain of your WordPress site might seem daunting, but it's a straightforward process if you follow the right steps. This guide will help you change your domain smoothly and efficiently, ensuring your website experiences minimal downtime.

Why Change Your Domain Name?

You might need to change your domain name for various reasons, such as rebranding, domain name expiration, or a more SEO-friendly URL. Whatever the reason, updating your WordPress site’s domain effectively is crucial to maintaining your site’s functionality and search engine rankings.

Step-by-Step Guide to Changing Your Domain

  1. Backup Your Website

    Info! Always start with a backup of your website. This ensures that you can restore your original site if anything goes wrong.

    You can use a plugin like UpdraftPlus or BackupBuddy to easily backup your WordPress site. Remember to save both your files and database.

  2. Register and Prepare Your New Domain

    Before you can switch, you need to have your new domain ready. Register your new domain through a reliable registrar and ensure it’s fully set up to point to your existing hosting account. For DNS changes, refer to our guide on DNS Management.

  3. Update WordPress Address

    • Go to your WordPress admin panel.
    • Navigate to Settings > General.
    • Update the WordPress Address (URL) and Site Address (URL) fields to your new domain.
    Warning! Make sure you enter the new domain correctly to avoid losing access to your WordPress dashboard.

    How to Update Database Links When Changing Your Domain

    When changing your domain, it's essential to ensure that all references to the old domain in your WordPress database are updated to the new domain. This can prevent issues like broken links and ensure that all your site features work correctly under the new domain. Here’s how to update your database links either via phpMyAdmin or using a WordPress plugin.

    Updating Database Links via phpMyAdmin

    1. Access phpMyAdmin

      Log into your cPanel and find the phpMyAdmin tool under the Databases section. Here’s a direct link to your cPanel: Access cPanel.

    2. Select Your WordPress Database

      Once inside phpMyAdmin, you'll see a list of databases on the left-hand side. Click on the database that corresponds to your WordPress site.

    3. Perform a Search and Replace

      • Click on the SQL tab at the top.

      • Enter the following SQL query, replacing and with your actual old and new domain names:

      • UPDATE wp_options SET option_value = replace(option_value, '', '') WHERE option_name = 'home' OR option_name = 'siteurl'; UPDATE wp_posts SET guid = replace(guid, '',''); UPDATE wp_posts SET post_content = replace(post_content, '', ''); UPDATE wp_postmeta SET meta_value = replace(meta_value,'','');
      • Execute the query by clicking the Go button.

      Warning! Be very careful when running SQL queries. Making incorrect changes can cause significant issues with your site.

    Using the Better Search Replace Plugin

    1. Install the Plugin

      Go to your WordPress admin dashboard, navigate to Plugins > Add New, search for “Better Search Replace,” and install and activate the plugin.

    2. Run Search and Replace

      • Navigate to Tools > Better Search Replace.
      • In the “Search for” field, type your old domain, and in the “Replace with” field, type your new domain.
      • Select all the tables to run the replacement on.
      • Check the box for a dry run to see what changes will be made before making them permanent.
      Info! Using a plugin like Better Search Replace can help avoid serialization issues that might occur if the database is manually edited.
    3. Perform the Replacement

      After verifying the changes with a dry run, uncheck the dry run option and run the replacement again to make the changes permanent.

    Final Checks

    After updating your database, clear any caches on your website and browser to see the changes. Test your website thoroughly to ensure that everything is functioning correctly.

    Using phpMyAdmin from your cPanel (you can access your cPanel here), run a search and replace for any instances of your old domain in the database. This can also be done using plugins like Better Search Replace, which is safer as it prevents potential database serialization issues.

  4. Configure Redirects

    Set up 301 redirects from your old domain to your new one. This step is crucial for SEO and user experience, ensuring that bookmarks and existing links still work.

    You can add the following lines to your .htaccess file:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^ [NC,OR]
    RewriteCond %{HTTP_HOST} ^ [NC]
    RewriteRule ^(.*)$$1 [L,R=301,NC]
  1. Clear Cache

    Clear the cache on your website using your caching plugin and your browser to ensure that you and your visitors see the website running on the new domain without issues.

  2. Test Everything

    After everything is updated, thoroughly test your site to ensure all aspects are functioning correctly—check internal links, posts, pages, and the admin area.

  3. Update Google Search Console

    Update your information in Google Search Console and any other search engine webmaster tools you use. This update will help maintain your site’s SEO standing and inform search engines of the change in domain.

  4. Notify Your Users

    Make an announcement about the change of domain to your users. This can be done via email, social media, and an announcement on your website itself.

Need Help?

If you encounter any issues during your domain change process, please open a support ticket here or initiate a LiveChat session using the icon located at the bottom right of the screen.

Success! By following these steps, you should be able to change your domain with minimal impact on your site’s operation or search engine ranking.

This transition might take some time to propagate across the internet, especially when it involves DNS changes, so a little patience goes a long way. Make sure to monitor your site’s functionality and search engine performance closely over the following weeks.

Was this answer helpful?

« Back