How to Migrate WordPress Website to a New Domain

How to Migrate WordPress Website to a New Domain

Had enough of your Web Host or domain ,because of site speed or they aren’t worth the money ? You don’t know how to migrate and you seek help ,but all you see is paid offers or expired articles ? Well we aren’t outdated ,so keep reading to learn more on How to Migrate WordPress Website to a New Domain + (New Web Host).

Many people want to change their web hosting ,since it became bad ,due to site speed or support is numb.We all had this problem ,as we had to change from one web host too ,but no need to worry about it.It’s normal.

Changing the domain is something strange to be honest.Except if you were using a subdomain or free domain , we really advice you to change the domain name , but if you already have your own domain name ,why would you do that ? Nonetheless ,but a well set domain name with high DA & PA ,wouldn’t be so good to be changed ,except if you are going to use that domain as redirect to the new one.

Before we start it would be good to tell you that you will need to resubmit your website to Google Search Console for indexing.

Also create a backup for your website so if something goes wrong , you can always restore a safe copy. Full backup Process

Well lets get started with this article and help you achieve your needs on How to Migrate WordPress Website to a New Domain

Deactivate All Plugins

Before you begin, I’d recommend that you deactivate all plugins because, when moving a WordPress site to a new host, the things that are likely to fail are your WordPress plugins. WordPress itself is well designed to adapt to new changes, but the plugins might not be.

Therefore, to deactivate all activated plugins, go to the admin page -> Plugins -> Installed Plugins -> Mark all -> Bulk action -> Deactivate -> Apply

Deactivating Plugins

Backing up WordPress Database and Files

It’s best practice to always backup your website before making any changes, and a WordPress migration is no exception. There are a couple of WordPress plugins for doing this, but a manual approach is best if you want to be in complete control of the process.

Now, I’ll show you how to backup your WordPress files and database with a manual approach, and also via a plugin.

Backing up Manually

To back up your WordPress database manually: Log in to your phpMyAdmin, click on your WordPress database and select Export as shown in the image below.

Export Database

Ensure that you’re exporting in SQL Format and click Go. Your WordPress database will then be downloaded as a .sql file. I recommend that you save the downloaded SQL file to a special folder on your computer so that you can easily locate it later. You can also use the command line to export a copy of your database, you can find more information on that here.

To backup your files manually: I would recommend that you download your complete WordPress installation folder so that you won’t lose anything.

Using any FTP/SFTP client like FileZilla, log in to your host by FTP/SFTP and download your htdocs or public_html folder (or anywhere your WordPress installation resides).

Backing up with a Plugin

Download and install the UpdraftsPlus Backup and Restoration plugin. At the Installed Plugins page, locate the UpdraftsPlus plugin and activate it.

Once you have the plugin installed, at the admin page, go to Settings -> UpdraftsPlus Backups, and then click the Backup.

Updraft Plus

This might take a while depending on the size of your WordPress site, but once the process has been completed, click on the Exisiting Backups tab to download the backup to your computer and then you can move it to a special folder too.

Preparing Your Backup for Upload

Now that we have the backup, we need to modify a few things before we can move on to uploading our backup(s). Before proceeding, log in to phpMyAdmin of your new host and create a new database. Note down the name of the database, as you will be needing it later in this tutorial.

Updating the wp-config.php file

There is some information to be modified in our WordPress configuration file before moving on. Extract the ZIP archive of the WordPress installation folder you downloaded earlier, locate the wp-config.php file and open it for editing using your favorite text editor such as Notepad and Notepad++.

Edit the lines below, replace with the details of your new host 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');

Uploading Your Backup

We’re almost done. The next action to take is to upload your modified WordPress installation folder to the new host via FTP/SFTP.

After uploading is completed, proceed to upload your database backup.

To upload the database backup, log in to your phpMyAdmin in your new host and click the Import menu as shown below.

Import

Select the SQL database backup and upload.

Updating the WordPress Home URL and Site URL

There are several ways to set your URL for WordPress, we’ll discuss a few common methods.

If you’re moving to a new domain too, ensure you have successfully pointed your new domain to your hosting account (refer to your hosting support documentation for the exact details).

 

Using wp-config.php

You can set your URLs by adding the following lines to wp-config.php, this overrides and will disable these options in the WordPress dashboard.


define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');

The WordPress Codex has a good explanation of this.

Using a WordPress Theme functions.php File

Paste the below lines in your active theme’s functions.php file immediately after the initial line, using the editor provided by an online FTP/SFTP client, or your preferred text editor.

update_option ( 'siteurl', 'http://your_new_domain_name.com' );

update_option ( 'home', 'http://your_new_domain_name.com' );

Replace the http://your_new_domain_name.com with your new domain URL. The above code will automatically update the siteurl home option names with your new blog URL in the database. Visit your WordPress login or admin page and your site should work.

Once your site is back up, ensure that you delete the lines you added to your theme’s function.php file to prevent the updating each time your site is viewed.

Manually Updating the WordPress Home URL and Site URL

To manually update your WordPress Home URL and Site URL, login back to your phpMyAdmin, open your WordPress database, click on the wp_options table and modify the values of the site_url and home column with your new URL.

Browse

Now that everything is working fine, go ahead and activate your necessary plugins. To do that, navigate to Plugins -> installed plugins, select activate from the Bulk action drop down and hit the Apply button.

To update your permalinks, go to Settings -> Permalinks, select your desired permalinks structure and Save Changes.

301 Redirection Setup

To transfer your old domains SEO juice (or SEO value) to the new one, it’s important that you set up a 301 redirect as follows.

Open the .htaccess file in your old WordPress install folder and append the rewrite rules below so that anyone visiting your site using your old domain URL will be redirected to the new domain.

<IfModule mod_rewrite.c>

RewriteEngine On

RewriteCond %{HTTP_HOST}^olddomain.com$

[OR]

RewriteCond %{HTTP_HOST}^www.olddomain.com$

RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301, L]

</IfModule>

Some Useful Tips

php.ini and .htaccess files
These files can contain settings that only work with your previous hosting, so if things don’t work, check these files first. Try renaming or commenting out various lines, and look for hard coded paths that might not exist on your new environment.

Caching Plugins
Some caching plugins will modify your .htaccess or create files to absolute paths that might not exist on your new hosting setup.

Google reCaptcha Plugin
In case you have any Google reCaptcha plugins installed, you should remember to get a new API key for your new domain, so that the plugin won’t find it difficult to display the reCaptcha.

Jetpack Plugin
Also, if you have the Jetpack plugin installed, you should remember to re-connect your WordPress site to WordPress.com because you’ve moved to a new domain.

Genesis Club Lite Display Module
If you have the Genesis Club Lite plugin installed, and the display module is activated, you should remember to change the domain part of your URL from the old domain to the new one. This is done at Genesis Club Lite -> Display -> Logo effect the change and save the changes.

Now that you have a fresh start ,it would be good to fix your SEO , so you can get fast indexing.Here’s how to do it.

Site speed is important for high ranking ,so never forget to set it up.WP Super Cache will get you ready for high placements in just 5 minutes.

If WP Super Cache isn’t your type of plugin ,we recommend you checking this

Leave a Reply