Port Existing WordPress Website to New Domain Without Losing SEO Ranking8 min read

In this article, you will learn to port existing WordPress website to a different domain.

If you are a returning user of this website then you will observe that the domain of the website has been changed without affecting anything else. Well, we have recently moved to a new .com (www.bemyaficionado.com) because of endless reasons which I will tell you in another article.

It was kind of challenging for me as this was my first time. I had not done anything like this before.

For this reason, I had to do a lot of research before making the move.

In this article I will share my acquired knowledge and experience of the entire process.

This article will surely help everyone to port existing wordpress website to a new domain.

Note: This article is for anyone who is porting his wordpress website to a new domain. It is not for someone who is porting a website to a new hosting provider I have written entirely different article. Find it here – How to port your existing website.


It is a good practice to carefully create a Roadmap before diving in blindly.

Roadmaps becomes even more important when your changes could compromis the entire system if gone wrong.

Following is the rough Roadmap to entire domain porting process:

  1. Secure website data. Backup all the contents of wp-content folder.
    I will leave it up to you how you secure your website content. I use git for that purpose. You can simply make a backup of your website using Duplicator plugin. It is up to you how your back your contents.
  1. Secure database.
    I use mysql database with phpmyadmin. I simply export the database from phpmyadmin console. It exports the entire database in .sql file which I can later import in my new database.Alternatively, if you have access to terminal then you can fire following command:
    mysqldump --databases test > dump.sql
  1. Download latest wordpress from the official website.
    Navigate to www.wordpress.org and download the latest wordpress package in zip file. Extract the file and you will get a wordpress folder.
  1. Replace wp-content folder of latest downloaded wordpress with the backed up wp-content folder.
    Now you will have to replace everything which is there in wp-content folder of newly downloaded wordpress folder with everything inside of your backed up wp-content folder. You can directly copy the files to the new wordpress folder.
  1. Upload the latest wordpress folder to the server.
    Once you have replaced the wp-content folder of the wordpress, it is now time to upload this folder to your hosting server. You can use filezilla to do that.I prefer git as it is faster, easier and secure. I use Digital Ocean’s cloud hosting to host my website as I like to have full control over each and every part of the website and server.

    If your website is hosted on shared hosting provider then you must first confirm whether you can host more than one website with it. If you can host multiple websites then create a new folder and upload the wordpress setup in it.

Setting up the database

I’m assuming that you are using mysql database and you have your .sql file.

Now, login to your phpmyadmin panel and create a new database with whatever name you want your new website to be.

Usually I name database by the name of the website. Since, it is a preference of choise you can choose any name for your database.

Once you have created the database, it is time to import that .sql file into it.

It is really simple, select the database and click import button from the tab. It will take you to a file import view. Use the file select to select the file and upload it. Refer the snapshot below.

phpmyadmin sql import

Once you have uploaded the file successfully, you will see the list of all the tables in the left sidebar under the selected database.

It is time to change the meta information about your new website from the database.

Select wp_options table from the left sidebar.

You will see the url of your old website in the first and second row of the table. Replace this URL with the new Domain.

That is all you need to do to port your existing database.

It is time to setup the new website

Setting up your new website

You need to point your domain to your new location. If you on a shared hosting then ask your provider to guide you on how to point domain name to the location. For those of you who are on the cloud hosting then you must point your new domain to your hosting server and use virtual host to proxy all the request coming from the new domain. If you have your website hosted on digital ocean then follow their article on setting up virtual host for your website.

If you have successfully setup the website then probably you would see a wordpress setup wizard like the one mentioned below.

Provide all the credentials for the database which we setup in the previous section. WordPress automatically detect the setup and prompt you with the login button. Login into your admin panel with the same credentials that you used to in the previous website.

At this moment, you have a website with working backend and frontpage. But all the links of the website is broken. Also all widgets mightl be disturbed.

So, just make sure you have everything in the right place.

Next thing you need to do is fix the links of the website. For that, click on setting > permalink and then click on the save button. It will automatically make the required changes.

That is all you need to do in order to port your website to a new domain But this is just half the part of the whole story. The main thing comes at the SEO level.

Here , you need to provide 301 redirects for the moved pages This part can be very tricky depending upon your requirements.

In my case, I had two different applications built on two different frameworks installed under the same domain

One application was based on WordPress and the other was built on CodeIgniter from scratch.

I only needed to move my wordpress website. This thing became quite complicated keeping in mind the efficiency and performance. But, in your case it might not be that difficult.

Redirect via Redirection Plugin

If you are more of a plugin guy, then this plugin will do the job for you. This is the best plugin that I have found on wordpress free plugin market which makes redirection very easy. If you have a little knowledge about regex then you can easily redirect all your pages to their new location.

Steps to redirect all requests to new domain,

  1. Install Redirection plugin.
  2. Put the below regex in the text bar of your redirection plugin.
    Add 301 redirect

    Do not forget to check the Regex checkbox next to the text box.
  3. Click on the Add Redirection button.

Now, all your request sent to your source website will be redirected to the target website with a 301 Permanently Moved header response. That is all you need to do in order to put 301 redirects on your website to redirect incoming traffic to your new website.

Redirect via .htaccess file

This is a faster way of redirection. Although the time saved is in milliseconds, so it does not have much difference unless your website is serving large amount of traffic. To redirect using .htaccess file, you will need to follow below steps,

  • Open .htaccess file present at the root of your website.
  • Paste below code at the very beginning of that file
RewriteEngine On
Redirect 301 /a-very-old-post/ http://yoursite.com/a-very-new-post/
  • Save & exit

That is all you need to do in order to redirect all users to your new website with a 301 Response header.

I found this article while searching for ways to redirect users to new domain which tells you about many other ways to redirect users with a 301 header. Here’s the article http://www.wpbeginner.com/beginners-guide/beginners-guide-to-creating-redirects-in-wordpress/

Notify Google

Last but not least, you will have to notify google about your domain migration. This is very easy. You can notify google from webmasters admin console. Follow below steps to submit a request at webmaster console,

  1. Login to webmasters console by navigating to www.google.com/webmasters.
  2. Add your new property (website) to google.
  3. Select the current website from search console and click on settings icon.
  4. Select Change of address from the dropdown.
  5. Refer the image below for further clarification,Webmaster submit domain migration request

That is all you need to do in order to port your website to a new domain. I have mentioned just the important points which you will need in order to successfully port the website to different domain. Read in depth about the above topics in your free time. This knowledge will surely help you in understanding how search engines work.

Please comment below if you have any concern or is there anything that you would like to know about.

  • Article By: Varun Shrivastava

  • Varun Shrivastava is an innovative full stack web developer. He is a passionate blogger and loves to write about philosophy, programming, tech and relationships. He works as a Software Developer. This is his den, you can get in touch with him here anytime you want.