wordpress

How to Move a WordPress Site to Another Domain Without Losing Anything

Do you have to move your WordPress site to a new domain for some reason? Do you want to make this process as smooth as possible without losing any of your precious data? This step-by-step guide will show you how to do that right.

thumbnail

There are right and wrong ways to switch domains, and the one we are going to show you today is the safest option for cautious website owners. In order to follow this guide, you should be somewhat familiar with the WordPress platform.

While the whole process is pretty straightforward, some people prefer to hire freelancers to help them. There is nothing wrong with paying someone to do it, but if you have any sensitive information or content you don’t want others to see, it’s best to switch domains on your own. 

Before Your Start

The whole process shouldn’t take more than an hour or two, especially if you follow our step-by-step guide carefully. However, there are a few things to note before you start. First of all, the process of changing domains will affect your website no matter what you do. However, it’s important to remember that this is temporary. 

The most precious thing that can be lost when you are moving to a new domain is the rating of the website. It takes years to stand out from the crowd and make it to the top of a Google search. And unfortunately, you can’t avoid some changes in your website rankings when changing a domain. Still, a lot can be done to make a move as seamless as possible (see steps 9-11).

Step 1: Create a Backup of Your Website

It’s always a good idea to create a backup before doing any changes (both the website and a database). While you can use plugins for this (BackupBuddy, for example), you can also download all files to your computer and save them in a separate folder. There are numerous ways to download the website files; we would recommend using the FTP client (such as FileZilla) or File Manager. 

Step 2: Check Your Current Website

Open your current website to verify that everything is working as expected. Let’s check the following:

  • Are all of your pages working?
  • Any there any missing or broken links?
  • Are all plugins updated?
  • Can you see all of your images and videos?
  • Are you using the most recent, up-to-date WordPress version?

If you have some extra time on your hands, it’s a good idea to clean the website a bit and remove everything that you don’t need anymore, be it plugins, assets, old themes, etc. 

Step 3: Download Your Website

Now, when your website is in great shape, it’s time to download all the files, both the website and the database, to your computer (see step 1). If you already have one copy saved, create a new folder with the same name but append v2 or final to the title of the folder. 

Now, it’s time to verify that you have all files ready. If so, let’s move to the next step!

Note: instead of moving your website manually, you can also use plugins to create and restore from a backup. Keep in mind that it will cost extra while this option is completely free.

Step 4: Export a Database

To export a database, open phpMyAdmin, click Databases in the top menu, find the database you want to export, click on the name, and then Export. Save a copy of the freshly exported SQL file in a separate folder.

Step 4: Upload the Files to Your New Domain

Take the most recent copy of the website and upload it to the new domain using FTP. If you made your backup with File Manager, you’ll also need to unzip it before uploading.

Step 5: Import a Database

Remember that SQL file we saved in step 4? Do the following to import it to the new database:

  1. Open the new database in phpMyAdmin
  2. Click Databases in the top menu
  3. Find the database you want to import to, click on it
  4. Click Import
  5. Choose your SQL file and click Go

Step 6: Update the URL

In order to update the URL, you first need to find the wp_options table in phpMyAdmin (use the menu on the left to locate it). There, you’ll see the two options – siteurl and home. Usually, they are located at the top of the wp_options table. For both options, you’ll need to click on the fields under option_value and change them to the new domain name. Then, click Enter to save. Please note thst both options will have the same value.

Step 7: Change the wp-config File

The wp-config file contains all your connection details. In this step, we need to update the login information and enter the new credentials from your new domain:

  1. Open File Manager on your new website
  2. Find the wp-config.php file
  3. Locate and update the login information

Step 8: Check the New Website

By now, you should have a fully functional website on your new domain. Just like in the second step, we need to verify that everything is working properly. Usually, there are small things that still need to be fixed. 

If you get a 404 error when clicking on some of the links, you can easily fix it in Settings:

  1. Go to your WordPress dashboard
  2. Click Settings, then Permalinks
  3. Scroll all the way down and then click Save Changes.

If you encounter some broken images or missing assets, it might mean that the links are still referring to the old domain. You can either replace those images manually or use a WordPress plugin such as Better Search Replace. This or a similar plugin will automatically update the domain in your database. If you have more than a few images to fix, this might be the best solution to save some time! 

Links and images are usually the only areas that are affected when you switch the domains. If you encounter any other issues, you might want to check out the WordPress codex for more help. 

Step 9: Set Up 301 Redirects

Note: This and the following steps are optional. If your website is private and you do not care about SEO at this point, you can skip these steps.

It will take some time for your SEO rankings to recover. However, there are some steps you can take to speed up the process. The most important thing you can do is to set up permanent 301 redirects on your old domain, which are very important for SEO and user experience. The redirects will automatically send users and search engines to your new website.

In order to do this, you will need to keep your old WordPress website active for some time but this step is really important if you are worried about your SEO and loyal customers. If you don’t set up the redirects on all posts and pages, the users will see a 404 error, and the search engines will have no idea where your new website is located.

There are two ways to set up the 301 redirects:

  1. Quick: Use a plugin such as All in One SEO or something similar. Often, you’ll need to pay for a pro version in order to access the redirects.
  2. Manual: This option is free but it requires editing the WordPress .htaccess file on your old domain name. Access your old website using the FTP client and locate the .htaccess file (it will be located in the same directory as your wp-includes or wp-admin folder). Now, open the .htaccess file and paste the following lines of code on the first line:
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ http://www.newsite.com/$1 [R=301,L]

Keep in mind that you’ll need to replace http://www.newsite.com with your new domain to make it work. Save the changes and visit your old website again. Now, it should automatically redirect you to the new domain.

Step 10: Notify Your Users

Redirects are great but it’s still a good idea to make a public announcement and notify your users. There are multiple ways to do this, from sending an email to everyone to writing a blog post. 

Step 11: Notify Google

When your redirects are working, it’s time to notify Google and let them know that you switched the domains. This way, Google will be able to find your new website domain quickly and display it in search results.

Make sure that both your new and old domains are added to the Google Search Console as two different properties. Then, click on the old domain name, select Settings on the left, and find the ‘Change of Address’ tool. Find your new domain under the Update Google section, and then click on the ‘Validate & Update’ button. Now, you are good to go!


Superb WordPress Development Services from PSD2HTML

Need help moving your WordPress website to another domain? Our expert WordPress developers are at your service. With 16+ years of industry experience and thousands of successfully completed WP projects, we know everything about the world’s most popular CMS.

Contact us for any WordPress development project, from building a custom theme or updating an existing one to developing plugins and optimizing Core Web Vitals.

Valerie Muradian

Valerie is a top writer, software developer, and book lover. She writes on the latest technologies, self-development, life-long learning, creativity, and everything in between. | Follow her on Twitter | Read her on Medium