How to move WordPress site to new domain without losing SEO

Sometimes after starting a website or a blog, user might recognises that, he needs a different domain name or he would like to move to different domain suffix (he might want to move from .net to .com or he might would like to move to country specific domain suffix like .in for India, .de for Germany ,*.fr for France etc). Whatever might be the reason, following steps needs to be followed for effective movement without losing SEO

Before you start further, current website is the live example of domain migration. I had started this website with domain name as, I was owning domain but I was planning to use it for one of my other requirement. After realising that its not a good idea to use same domain name for two different ideas, I decided to move from .net to .com domain.

Note: I no longer own domain and I dont need to redirect now as my .com website is live for a while now.

Before you start

You have two options for doing this change 1. Do the change on the live site 2. Do the changes on backup.

I suggest to use the second approach. Here, you don’t touch existing WordPress folder, you create a copy of current WordPress installation with new domain and simply change nginx config of old domain.

Step#1 Take Backup

This is the most important as you dont know what can go wrong during the migration. If something goes wrong, you can simply override the changes with the backups that you have. You need to take backup of three things

  • MySQL Database backup.
mysqldump -u [username] -p [databaseName] > [databaseName].sql
  • Folder which has your code (WordPress folder, including themes and plugins

Connect to your server using filezilla and copy folder as well as  MySQL dump to your location machine.

  • Back up NGINX config file

NGINX config file for any domains are located @ /etc/nginx/sites-available on a Ubuntu server

Step#2 Configure new domain on server

You need to make sure you have added A and CNAME records correctly. On your server as well as your domain registrar. This is exactly same as that of your earlier domain nothing different.

Once done, please create a nginx config file as explained in this post. Please refer to “Configure nginx” of this post.

This step is nothing new, it’s same that you would have followed while setting up your earlier domain which you need to be replaced with new domain.

Step#3 Changing the domain name

Go to Settings–>General and change the URLs from existing domain name to desired domain name.

Once you save this, you might get automatically logged off and you will have to login again. This will login using new domain

Step#4 Update internal and hard-coded links

You might have internal reference to your sites between different posts. Also, some links might be hard-coded in navigation bar. You need to get these changed. Changing this manually is easy if you have very few posts but if you have 50+ posts on your blog, doing this manually is not a good choice from efficiency and effectiveness point of view. You have following options to do this.

  1. Use the Velvet Blues Update URLs plugin if you can access your WP Admin Dashboard.
  2. Use the Better Search Replace plugin if you can access your WP Admin Dashboard.
  3. Use WP-CLI’s search-replace if your hosting provider (or you) have installed WP-CLI.
  4. Use the Search and Replace for WordPress Databases Script to safely change all instances on your old domain or path to your new one. (** only use this option if you are comfortable with database administration ** )

I personally used Velvet Blues Update URLs and it was effective.

Step#5 Adding 301 redirect.

Now you have moved to new blog, your internal links are taken care of but what about external links ? Someone might have hard-coded you link ? For example, one of my post was mentioned in a GitHub issue as a solution. This issue is already closed, I can not ping everyone to change the user reference. Then how to handle it ?

Best solution is using 301 redirect in your old domains server. I am using NGINX and this can be achieved using below

server {

    return 301 $scheme://$request_uri;

Note: You need to continue owning old domain to ensure redirect is happening

Step#6 Updating Google and Bing webmaster

Since, Google and Bing will crawl your websites based on details you have provided in webmaster tools, updating your website with correct domain is very crucial.

Most important part is you update you sitemaps.

Step#6 Update Google Analytics (Optional, needed only if you are using Google Analytics)

Once this is done, you will continue to get new visitors using SEO as well as you will not lose your existing visitors due to


Leave a Reply

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