How to Change Domain Name in WordPress

Today I read a question on Facebook Group. I also intend to write about this.

“I guess it’s a very basic question for you all pros here:) I need to change my domain name..how do I go about it? I already have a live and running WordPress website. I bought my domain at GoDaddy and my host is HostGator..thanks so much!”

In this post, we will learn how to change domain name in WordPress without losing SEO.

I will use cPanel Hosting on Hawkhost. Because most people use cPanel Hosting.

Old domain name is old-example.com. New domain name is new-example.com. Both bought at Godaddy.

Let’s start.

Step 1. Point new domain name to Hosting

Go to Godaddy > Sign in

bbhero-point-godaddy-domain-to-cloudways1

Fill your username and Password

login-godaddy1-min

Click DNS

godaddy-dns1-min

Click “Pen” icon at Type A and Type CNAME

godaddy-dns2-min

Type A

  • Host: @
  • Points to: IP of Your Hosting. Contact Hosting Provider to know this.
  • TTL: Leave Default

godaddy-dns3-min

Type CNAME

  • Host: www
  • Points to: your domain name (non-www), eg. new-example.com
  • TTL: Leave Default

godaddy-dns4-min

Step 2. Add domain name to hosting

Log in cPanel at New-Example.com/cpanel

log-in-cpanel-hosting-1

Click Addon Domains

addon-domains1-min

Enter Your New Domain, eg: new-example.com

  • New domain name: eg. new-example.com
  • Subdomain: Leave Default
  • Document Root: Folder hosted your site. Remember to choose correctly.

Document Root can be:

/public_html: If your hosting is hosted 1 Domain

/oldomain.com: If your hosting is hosted multiple domains

Then click Addon Domain

addon-domains2-min

Success!

addon-domains3-min

Step 3. Change Domain Name in WP-Admin

Settings > General. You will see

site-url2-min

Change WordPress Address and Site Address to New-Example.com

site-url3-min

Scroll down and Click Save Changes. WordPress will automatically log out. You need to log in again.

wp-login-10

Step 4. Replace all old link to new link

Plugins > Add New > Type Better search replace > Install Now

better-search-replace1-min

Activate

better-search-replace2-min

Tools > Better Search Replace

tools-better-search-replace1-min

Search for: your old domain, eg: old-example.com

Replace with: your new domain, eg: new-example.com

Select tables: select all

Run as dry run?: Uncheck

Then click Run Search/Replace

tools-better-search-replace2-min

Done!

tools-better-search-replace3-min

Step 5. Save Permalinks

Settings > Permalinks > Save (No need to do anything)

settings-permalinks-save-changes-min

Step 6. Redirect Old Domain to New Domain

Log in to cPanel

log-in-cpanel-hosting-1

Click File Manager

file-manager1-min

Click Settings (Top right corner) > Check Show Hidden Files (dotfiles) > Save

cpanel-show-hiddens-files1-min

Click public_html > .htaccess > Edit

edit-htaccess1-min

Paste these line into .htaccess

RewriteEngine On
RewriteRule ^(.*)$ http://new-example.com/$1 [R=301,L]

edit-htaccess2-min

Save. Done!

Step 7. Add New Domain Name to Google Search Console

You need:

  • Add New Domain Name to Google Search Console
  • Submit Sitemap
  • Increase Crawl Rate
  • Change Address in Your Old Domain (Added in Google Search Console)

and Done!

Updating….

Share this post:

Leave a Comment