The Ultimate Guide on How to Change WordPress Domain Address

Today we are going to share something very basic for WordPress Developers, but quite complex for general WP users. Recently, we have encountered many queries on changing domain names of WordPress powered sites. So, we have prepared this step by step guide to explain how to change WordPress site address (URL).

There are several ways of migrating your site to another domain. Here, we will discuss the easiest method. Let's find out how.

Change the Domain of Your WordPress Site

To make things clear, we have divided the whole process into several steps.

Prerequisite

Before proceeding with the migration, you should have –

  • Know what you are doing
  • Access to your cPanel & FTP
  • A new Domain
  • Backup everything

 

The most important thing before jumping into action is to make a full backup. You can backup everything manually and export the database. There are also several powerful plugins which have backup functionalities. Some handy plugins are Updraftplus, BlogVault, VaultPress etc.

Find more must have useful WordPress plugins.

When you are done with a complete backup. Proceed to the next step.

1. Add New Domain to Your Hosting

To use the new domain, you need to add it to your hosting. You can easily Add you domain from cPanel. Just click on the Addon Domain Option.

Now, enter your new domain address, subdomain, and document root. Click Add Domain.

2. Copy the Old Domain Folder to the New One

Download your backup file or you can directly copy your previous folder to the new domain folder. This process is easier if you are not switching your hosting. If you are migrating to a new hosting as well, you will need to download your backup and add it to your FTP. You can do all these with cPanel easily.

3. Change the Site URL in wp-config.php

Now, open your new domain folder. Edit the wp-config.php file and define site URL and site home page for your new domain. You can use the following code.

define('WP_SITEURL', 'http://newdomain.com');

define('WP_HOME', 'http://newdomain.com');

You must replace newdomain.com with your new domain name.

4. Updating Database Info [Optional]

In this tutorial, we are migrating the domain name only, not changing the hosting. Thus, there is no need to change the database. If you need to change the database, you will need to update the database info inside the wp-config file of your WP installation.

Log in to your cPanel and click on the File Manager.

Navigate to your WordPress installation folder and find the wp-config.php file. Right click on it and click Edit.

You will find an editing interface. Look database base name and replace the old one with the new one that you have created (if required).

5. Install Search and Replace Plugin

Now, login to your new domain WordPress Admin Dashboard. You will need to install Search and Replace Plugin. It will help you to search and replace anything you want within your WordPress. Simple, replace the new domain with old domain. Now, Search and Replace new domain with old domain.

6. Clean Cache and Refresh Browser

Cleaning cache can solve many unwanted issues. So, clean your cache and refresh your browser. Now, visit your new domain homepage.

7. Redirect Old Domain to New Domain

In this stage, you will require to setup a permanent 301 redirect to your website. This will help with both user experience and SEO of your site. Your users, who will land to your website from search engine, will be redirected to your new domain.

To set up permanent 301 redirect, log in to your cPanel and click on the file manager and open your websites folder. Now, find the .htaccess file and click on edit.

Now, add the following code to the top of your .htaccess file.

#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.newsite.COM/$1 [R=301,L]

You must replace newsite.com with your newly added domain name.

Wrapping Up

If you haven't  put the code in wp-config file to change site addresss or domain name, you can follow this process. Log in to your WordPress Admin Dashboard and navigate to Settings → General.

Under general settings, you will find two fields named WordPress Address URL and Site Address (URL). You will notice it has your present domain included.

Change the old domain name with the new one. For example, if your new domain is ‘newdomain.com‘ and the old one is ‘olddomain.com‘. Replace the old one and Save changes.

Change the Domain of a WordPress Site

Now, you have successfully migrated or changed your old domain name with a new one. The only thing left to do is to notify about the changes you made.

You should notify search engines such as Google. To do so, visit Google Webmaster Tools and login to your account and click on the Change of Address under Configuration. There is an option ‘Tell us the URL of your new domain'. Just add your new site URL and verify. You should also let your users know about the change to avoid confusion.

So, what do you think? Isn't it easy to change the domain name of a WordPress site?

If you know any other process, please comment below and let us know.

4 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *