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 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.
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.
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.
Login to your website via FTP and upload the previously saved backup to the webspace of your new domain.
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.
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.
Here you should replace the old login details with your new 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 with editing the details.
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 of 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).
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.
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,