Change Domain Name – [ Complete Guide ]


Change Domain Name without sinking any link juice? Domain names are one of the most crucial factors for your site branding and sooner or later we change our domains. But how it is possible?

Here in this detailed domain name migration guide, we will teach you how can you do this without any help from any WordPress expert.  Before we start moving our website let us discuss what we are planning to do.  But before that answer these two simple questions.

  1. Do we have two separate hosting for our current domain name as well as our new domain name?
  2. Do we have only one domain name with web shooting and one domain name without any web hosting?

So we have two situations and we will deal with each one of them separately.

Change Domain name without any extra web hosting

When you have this situation ie you purchased your new domain name and you want to change only the domain name of your existing website without having any extra hosting. Just open the domain name server account and change the nameserver of your current domain name, Place a redirector to the top level domain.

but in this case, when you will open your website all the contents and other links will still point to old domain names. So the point is,  you have to run a few SQL queries inside your  WordPress MySQL database.

Here are the steps that we are going to follow to change domain name without any extra hosting.

  1. Change domain name inside your database
  2. Change link URLs from old domain to new domain
  3. Put redirector from old domain to new domain.
  4. Change website address in Google search console

But in this case, you might sink a lot of link juice as you are only managing and changing the domain name and this way you can lose a lot of backlinks from other websites as they are not going to change their links and you also do not know how many websites are pointing to your current website.

Change domain name inside your database

All your website settings are saved in a MySQL database table wp_options. First of all, you have to change the name of your new domain inside the Settings->panel. Changing domain name here will enable you to login to your new website. 

Do not try to refresh here as this action may break your whole website setup. In the next step, you are required to change the nameserver of your website. so login into your Domain name provider and change the nameserver as per your new name server.


Now you will be able to login into your new website but all the internal links and images are still following the old domain name. Now its time to change your old domain name into a new domain name using following SQL commands but before that, I would recommend you to take backup of your database using PHPMyAdmin

Open your website’s database using PHPMyAdmin and issue the following SQL Commands

  • update wp_options set option_value =’http://your_old_web_site_url.com’ where option_name=’siteurl’ or option_name =’http://your_new_web_site_url.com’;

Above command will do the same what we have done in the previous step using WordPress admin Panel ->settings

2. Change Domain URLs from Old Domain to New Domain

You need to fix the URLs for the GUID field in the wp_posts table. This is crucial because GUID is used to translate your post or page slug to the correct article absolute path if it is entered wrongly.

  • update wp_posts set guid=replace(guid, ’http://oldsite.com’,’http://newsite.com’);

WordPress uses the absolute path in the URL link instead of a relative path in the URL link when storing them in the database. Within the content of each post record, it stores all the old URLs referencing the old source. Therefore you will need to change all these URLs to the new domain location.

  • update wp_posts set post_content= replace(post_content,’http://oldsitename.com’,’https://binarynote.com’)

By default WordPress store absolute path of the relative images and this create a lot of problems whenever we change our server. SO how to change the image paths stored in the post contents

  • update wp_posts SET post_content = REPLACE (post_content, ‘src=”https://www.oldsit.com”,”src=”https://newsite.com”);

The above query only changes the source of images, not the attachments available with that post, So issue the following query also along with the above one.

  • UPDATE wp_posts SET guid = REPLACE (guid,’http://www.oldsite.com’,’http://newsite.com’) WHERE post_type = ‘attachment’;

Post meta is also stored in the same way as your post image and other URLs ie, absolute path, so change them according to the new website address.

  • UPDATE wp_postmeta SET meta_value = REPLACE (meta_value,’http://www.oldsit.com’,’http://www.newsit.com’);

This way you have changed old domain name to the new domain name inside your WordPress database. All these queries are taken from SQL queries for WordPress database Administrator.

3. Change link URLs from old domain to new domain

Since You are not using the complete website, you can not preserve the whole website link juice but at-least whatever you can do, you should do now.

change domain name-4

Open your domain name registrar and place domain name forwarder. so that if anyone comes to your old domain at-least that must be redirected to your new domain name.

4. Change website address in Google search console

After all, we are doing all these changes so that we can achieve better search results and what will happen when you are unable to notify your big brother about all these changes? So open Google search console and change your website address here.  ( This is only available in Old version of search Console )Change Domain Name

Alternatively, you can also submit your website’s new sitemap for faster indexing.

Change Domain Name with extra web hosting

The process we will discuss here have the following steps.

  1. Take Backup of your current website ( Old Domain )
  2. Install WordPress in this newly acquired domain name.
  3. Restore this backup on your new website ( New Domain )
  4. Put 301 redirectors to preserve all the link juice
  5. Change website address in Google search console.

1. Take Backup of your current website ( Old Domain )

Here I would recommend you to install “All in one WP Migration” plugin,  install this WordPress plugin into your current website and just create a backup file of your current website. This file will have everything that you need to populate the new domain name.

Domain Migration Plugin

Once it is installed, Click on “Export” option of this plugin and select the location file

WordPress backup for Domain migration

2. Install WordPress in this newly acquired domain name.

There are thousands of article already available on the internet who can teach you how to install WordPress on a new Domain Name.  The simplest method I have found among all of them is automated scripts that are available on almost all the hosting packages.

3. Restore this backup on your new website ( New Domain )

You again need to install the same “All in one WP Migration” plugin here and now you need to select restore the backup. This option will re-write all your existing files as well as your database entries.

Restore Backup for domain migration

In case your server is not allowing you to load such a large size, take the help of how to increase the maximum upload size article available on this screen.

4. Put 301 permanent redirectors to preserve all the link juice

Now you have two website having same data, if you will leave your websites as it is you are bound to sink all your website link juice as well as you are bound to face duplicate data penalty. so 301 permanent redirect is compulsory here. Open your .htaccess file and add the following lines.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^old_domain_Name.com [NC,OR]
RewriteCond %{HTTP_HOST} ^www.old_domain_name.com [NC]
RewriteRule ^(.*)$ https://new_domain_name.com/$1 [L,R=301,NC]

The above example will redirect all your old URLs like

  • https://olddomain.com/about/

into a new domain like

  • https://newdomain.com/about/

here in the above example, we are moving our old domain in a new domain enabled with SSL certificate.  HTTPS must be replaced with HTTP if you are not using any SSL certificates. Check all your redirections using webconfs.com’s redirector tools.

05. Change website address in Google search console.

This method is exactly the same as we have discussed in the previous method so follow the same steps to do the needful.

The conclusion of both method – Migration from One domain to another Domain Name

The first method is only for those who have budget conscious and do not want to spend any extra penny. The second method is tried and tested on many websites and has been proved that this way you will be able to maintain your ranking/readers.

Though I have taken utmost care so that you could not lose even a single link juice in this process, still, if you find I am anywhere wrong or missed any step while moving my site from old domain to new domain, please let me know via your comments.

Related Posts

Leave a Reply

Your email address will not be published.