How to Transfer a WordPress Site from a Domain to another Domain

Moving your WordPress website to another domain is hectic if it’s not done properly some bug will arise and your website will be in trouble. Here you are going to learn a proper tutorial on the migration of WordPress website from one domain to another domain.

We are going see to step by step process of how to migrate a WordPress website manually.

Step 1:
Deactivate All Plugins

We would recommend you to deactivate all the plugins that you have used for this WordPress website which you are going to migrate because sometimes plugins might not work on the new domain.To deactivate go to the admin page  Plugins -> Installed Plugins -> Mark all -> Bulk action -> Deactivate -> Apply


Step 2:
Backing up Databases and Files

 Before making any changes to the website to take backup is always better, to backup WordPress data manually, log in to your phpMyAdmin, click on your WordPress database and select Export


Make sure that you are exporting in SQL format and select GO, now your file will be downloaded in .sql file.

Step 3:
Preparing your backup file to upload

Now we are going to upload the backup files, before proceeding it login to phpMyAdmin of your new host and create a new database.
Updating the wp-config.php file
Extract the WordPress Zip file folder that you have downloaded earlier, find the wp-config.php file and edit it.
Edit the lines by replacing it with your new hostname and save.

define(‘DB_NAME’, ‘replace_with_database_name_you_noted_down’);
/** MySQL database username */
define(‘DB_USER’, ‘replace_with_new_host_mysql_user_name’);
/** MySQL database password */
define(‘DB_PASSWORD’, ‘replace_with_new_host_mysql_password’);
/** MySQL hostname */
define(‘DB_HOST’, ‘replace_with_new_mysql_host’);

Step 4:
Uploading your Backup

Now, we have to upload the modified WordPress folder to your new host via FTP/SFTP.
To upload the backup database, log in to phpMyAdmin in your new host and click Import.



Step 5:
Updating the WordPress Home URL and Site URL

There are many ways to set your URL, we are going to learn how to do it manually.
To manually update the WordPress Home URL and site URL, login to your phpMyAdmin account, open WordPress database, click on the wp_options table and change the values of site_ URL and home column.

Step 6:
Reactivating All Plugins and Updating Permalinks

 Now you have done everything to migrate your WordPress after everything works properly you have to reactivate the plugin that you have deactivated before backing up.
In order to that navigate to Plugins -> installed plugins, select activate from the Bulk action drop down and hit the Apply button.
In order to update permalink, go to Settings -> Permalinks, select your desired permalinks structure and Save Changes.

Step 7:
301 Redirection Setup

 For SEO purpose and avoid the duplicate content penalty, you have redirected the old domain to your new domain using 301 redirects.
Open the .htcaccess file in your WordPress install folder and the rules as below.

IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST}^$
RewriteCond %{HTTP_HOST}^$
RewriteRule (.*)$$1 [R=301, L]

That’s it, now you have migrated your WordPress domain from one server to another server and also redirected it.

Leave a Reply

Your email address will not be published. Required fields are marked *