- 9 min
If you're new to setting up WordPress themes and want to get the hang of it, this article is your guide.
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.
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).
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.
Open your current website to verify that everything is working as expected. Let’s check the following:
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.
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.
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.
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.
Remember that SQL file we saved in step 4? Do the following to import it to the new database:
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.
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:
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:
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.
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:
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.
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.
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!
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.