If you want to move your existing WordPress website to a different domain, it’s important to make it as carefully and quickly as possible so as not to lose your content, traffic, and SEO ranking.
Before you start, we should say that the migrating process supposes that you’ve already got a hosting account and you know how to use your hosting control panel.
In this post, I will show you how to easily migrate your website to the new domain without losing your information and rankings.
So let’s see what steps you should perform.
1. Make the Backup
The first thing you need to do is to create a backup of your website which means you should download the files of your site including all of its data. Download the files of your website to your PC and save a copy of your files in a separate folder to keep them as a backup.
To make it clear, please read this guide on how to backup and restore WordPress. You can also read this post on importing and exporting your website’s content to get an insight into the overall process of WordPress files backup.
2. Export Your Database
Export your website’s database with phpMyAdmin and save the copy of the exported SQL file in a separate folder on your PC for a backup.
Go to your phpMyAdmin and click ‘Databases’ in the top menu.
Select the database you want to export and click on its name.
Click ‘Export‘ in the top menu.
Select the export method checking the ‘Custom – display all possible options’ option.
Choose the tables you want to export or leave them selected by default.
Scroll down to manage the format-specific options and check the ‘Add Drop Table/View/Procedure/Function/Event statement’ in the ‘Object creation options’ section.
Scroll down and click the ‘Go’ button to start exporting.
You will have the database file saved on your PC.
3. Upload Files to Your New Domain
Login to your website via FTP and upload the previously saved backup to the webspace of your new domain.
4. Import Your Database
Import the recently saved backup of your database to your PHP MyAdmin.
Login into the Control panel. Go to phpMyAdmin and select the database you want to access (See part 2 of this article).
When your database in your phpMyAdmin is open, click Databases in the top menu. Click ‘Choose file’, find the database you want to import on your PC, and click ‘Import’ in the top menu. After that, click ‘Go’ at the bottom of the page to start importing.
Now you are done.
5. Change Your Site URL
Go to wp_options in the left menu and find ‘siteurl’ and ‘home’ (or ‘blogname’) options in the table. Click the field under ‘option_value’ and update the ‘siteurl’ and ‘blogname’ information.
Press Enter to save the changes.
6. Update wp-config.php
Here you should replace the old login details with your new ones.
Connect to your site using an FTP client and locate the wp-config.php file there. Right-click the file to open and edit it; insert your new login details instead of the old ones.
They will look like these:
define( ‘DB_NAME’, ‘first_example’);
define( ‘DB_USER’, ‘first_example’);
define( ‘DB_PASSWORD’, ‘********’);
define( ‘DB_HOST’, ‘first-example.mysql.com’);
Insert your new details instead of ‘first_example’, ‘********’, and ‘first-example.mysql.com’ to change the db_user, name, password, and host information.
Don’t forget to click ‘Save’ when you are finished editing the details.
7. Create Redirection
Now you should send all of your users from your old website address to your new one. This is why it is required to set up a permanent 301 redirection. Please read this 301 redirection post to learn more about this type of redirect and its purpose.
Connect to your site using FTP and locate the .htaccess file. Insert the following code into the file (into the top of it).
#Options +FollowSymLinks
RewriteEngine on
RewriteRule ^(.*)$ https://www.yournewsite.com/$1 [R=301,L]
Insert your new domain name instead of yournewsite.com. Save the changes after you are done.
Now if you visit your old website it should automatically redirect you to your new domain name.
8. ‘Change of Address’ Tool in Google Search Console
When you’ve moved your website to a new domain, request an address change in Google Search Console. You can find the detailed guide on how to properly do it on the Search Console Help official support page. Now your new website can be properly indexed by Google.
By now that is all,
Hope this was helpful,
Melany H.