Migration is not a regular part of a site manager’s job description.
Generally, website owners choose to migrate a website only when they’re facing issues with their current host. The nature of the issues can vary, from performance issues to high costs and even a lack of support.
Whatever the reason maybe, migration is not exactly straightforward. Even on WordPress where you can use plugins to aid the migration process, there are things you need to remain mindful of.
Here’s how you can migrate your WordPress site to a new host:
- Select a new hosting partner for your website.
- Back up and export your WordPress website.
- Import your website to the new hosting partner.
- Edit your wp-config file.
- Point your domain to your new host by changing the nameservers.
Alternatively, you can use a variety of migration plugins to complete the process automatically. We will explore both these options in detail. First, let’s see how the process works without plugins.
Migrating your WordPress website (without plugins)
Plugins do make migration easy, but they often run into reliability issues. Some plugins may not be compatible with a particular host, or your website size may exceed the plugin’s storage limit.
It is thus important to know how to complete website migration manually. Knowing the process on a granular level will help you complete website migration successfully without worrying about plugin compatibility.
Let’s dive in.
Step 1: Select a website hosting provider
Why does one migrate a website? It is usually because they’re not happy with their current hosting provider.
The reason can be anything. High costs, poor performance, bad customer service; hosting churn can happen for a variety of reasons.
So how do you select a new host for your WordPress website?
Let’s first classify website hosts into two broad categories:
- Shared hosts: On a shared website host, your site is hosted along with many other sites on one main server. This means you compete for bandwidth with multiple websites. Shared hosts are limited in terms of performance, but they are cheap. If you’re launching a new website and expect little traffic, a shared host is not a bad idea.
- Managed hosts: Managed hosts are designed to work optimally in a WordPress environment. They’re better in terms of performance, speed, and security. While they’re expensive, you can lean on their customer service whenever you run into issues. For an established website with over 1K traffic a month, managed hosts are much better.
Both WP Engine and SiteGround are examples of managed WordPress hosts. These hosts can massively improve your website speed, and offer you managed solutions for performance and security.
Basically, you can stop worrying about hosting and focus on growing your site.
Once you’ve purchased a hosting plan, you can start the migration process.
Also read: Shared vs Managed hosts: A complete comparison
Step 2: Backup and export your WordPress site
Next, you need to backup your existing WordPress website. There are many ways to back up your WordPress website.
Ideally, you should ask your website host how to create a restorable backup. Website hosts generally have built-in backup mechanisms. Alternatively, you can use plugins like Duplicator and All-in-one WP Migration to backup your site.
Next, you should export your WordPress website. You need to export three main components:
1. wp-content folder
2. wp-config.php file
3. Your website database.
Follow the steps below to learn how to do this:
- Open your existing website host’s cPanel.
- Navigate to the File Manager and open the public HTML folder.
- Here you will find the wp-content folder. Create a zipped version of this folder and download it to your local device. You can simply right-click the folder, click on Compress, and create a zipped version.
- Along with the zipped folder, also download the wp-config.php file.
- Now, go back to your cPanel dashboard. Click on PHPMyAdmin here.
- On the new screen, select your data base from the left panel.
- In the left panel, select the ‘options’ table. Check if the value of option-names siteurl and home match with your existing website. This is just a cautionary step to ensure that the database you’ve selected is correct and corresponds to your existing website.
- Again select the whole database from the left panel.
- Select the ‘Check all’ box.
- In the top panel, click on Export.
- Let the export method be quick and set the format as SQL.
- Click on Go.
- Your database would now start downloading. Depending on the size of your website, this can take a few minutes.
Now you have all the things you need to migrate to your new hosting provider.
Step 3: Import your website files and database to the new host
Let’s start. You need to upload your files and database to the new website host. The process is fairly simple but can take a little time if your site is large.
It is advised that you first import all your files to a new subdomain. If the process works, you can simply repeat it for your main website.
3.1 Install WordPress on your subdomain
If you already have a subdomain, the process is fairly simple. If not follow the steps below:
- Create a subdomain in your new website host’s cPanel.
- Typically, there’s a button called Subdomains in your cPanel. Click on it.
- Enter your subdomain name. The parent domain should be your main website
- Once the subdomain is created, go to your domain registrar.
- Create a new A record. In the Host field, enter your subdomain name. You only need to write the prefix of your subdomain and not the entire URL.
- In the Value field, enter the IP address of your new host.
- Your subdomain would now start pointing to the new host. DNS propagation typically takes 2 hours, but it can happen sooner.
Once this subdomain is created, it’s time to install WordPress in it. There are again two ways of doing this. You can either install WordPress manually or do it through an installer.
In a manual installation, you simply need to download WordPress.
- Visit the official WordPress website and download the latest available version.
- Next, go to your new host’s File Manager. You should be able to find a folder named after your new subdomain.
- Open the folder, and upload the WordPress folder you downloaded earlier.
- Remember to unzip the folder after uploading it.
- It is recommended that you use your host’s file manager for uploading the files. Files can otherwise be uploaded via FTP as well, but the process is much slower.
- Once the upload is complete, go to MySQL Database Wizard. Here you will create a new database.
- In the first step, type in a data base name and create a data base user. You will be asked to set a username and password for the user you’re creating for the data base. Make note of details as they would be required later.
- Grant all permissions to the database user you have just created.
- Now return to your file manager. Open the wp-config-sample.php file here. You will find the following lines here:
/** MySQL database username */
/** MySQL database password */
- Enter your database name within the single quotes where it says ‘databasebase_name_here’. Similarly, enter your database username and password where it says ‘username_here’ and ‘password_here’.
- Now rename the file as wp-config.php.
- You can now start the WordPress installation. Run the following line in your browser: https://example.com/wp-admin/install.php. Remember to replace ‘example.com’ with your subdomain.
- Here, you will be asked to choose a language for your installation. Choose English and enter other details such as your username, password, site title, and more.
- Remember to check the box next to Search Engine Visibility. This will discourage search engines from indexing your subdomain.
- Click on Install WordPress when you’re ready. The installation should only take a few minutes.
- When you visit your subdomain now, you should see a blank version of WordPress installed.
With an installer
cPanels generally come equipped with automatic WordPress installers. You will generally find a WordPress button in your cPanel.
- Click on the WordPress button.
- Select the subdomain you just created from the dropdown.
- You will also see options to enter your admin username and password. Enter the same as you’ll need them later to log in to your site.
- On this screen, you will see a button called Advanced options. Click on it.
- You will see the data base name and table prefix here. The installer will automatically create a data base in your cPanel and upload the latest version of WordPress to your subdomain folder. Thus, you don’t have to go through those steps again.
- Make note of the data base name as you will need it later.
- Once WordPress is installed, go to your subdomain. You will find a blank version of WordPress installed here.
3.2 Import your database
Now that a blank version of WordPress is ready, all you need to do is upload your website database and files. Let’s first start with importing the database.
- Go to PHPMyAdmin from your cPanel.
- In the left panel, look for the database in which WordPress is installed. If you installed WordPress manually, you should see the database name you set here. Simply click on it.
- If you installed WordPress with an automatic installer, search for the database with the same name you noted earlier and click on it.
- You will see a blank set of tables after clicking on your database. These are blank because you just installed a fresh copy of WordPress without any actual images, posts, or pages.
- Click on the Check All box. In the dropdown beside it, click on Drop. This will remove all the tables from your fresh installation.
- Next, select the Import button from the top panel.
- Click on Choose file and upload the SQL database you downloaded from your previous host’s cPanel.
- Click on
- Once the import is complete, go to the options table. You should be able to find it from the left panel under your current database. Here, you need to update your siteurl and home.
- Click on the edit button in the row with the option name as siteurl.
- Change the URL to your current subdomain.
Similarly, update the value for option name as home.
3.3 Import your wp-content folder
Once your database import is ready, all that is left is uploading your website’s files. To do this, go to your file manager.
- In the File Manager, open your subdomain folder.
- You will see a wp-content folder here. Delete this folder and upload the wp-content file you downloaded from your previous website host.
Once the upload is complete, unzip the file in the same subdomain directory. You can delete the zip file once the extraction is complete.
Step 4: Edit your wp-config.php file
If you go to your subdomain now, you will still see a blank WordPress site. To change this, you need to make a small edit to your wp-config.php file.
- Open the File Manager and navigate to your subdomain folder.
- Locate the wp-config. php file. Right-click on the file and select Edit.
- Here you will find a line saying: $table_prefix = ‘wp_’;
- You need to essentially update the prefix to match your current database. If you used automatic WordPress installation, you would have noted the table prefix along with your database name.
- In the wp-config.php file, simply replace the prefix with the name you noted earlier.
- If you didn’t use automatic installation, go back to PHPMyAdmin and locate your database.
You will find a common prefix behind every table in the left panel menu. Note the prefix, and update it in the wp-config.php file.
Now your subdomain should load your existing WordPress website normally. If the process works as intended, you can go ahead and install WordPress on your main domain. There are a few things you would need to do differently this time:
- If you install WordPress manually, you would need to upload the new installation in the public HTML folder in your File Manager.
- If you install WordPress with an automatic installer, choose your parent domain as the installation directory. Don’t choose any subdirectory to ensure that WordPress is installed directly to your new site.
- While running the installation URL, remember to use your main domain and not the subdomain. This is applicable to those who install WordPress manually.
- You can leave the box next to Search Engine visibility unchecked. This is because you want search engines to index your website this time.
- Once you complete all the steps mentioned here, your site will still point to the old server. You thus need to complete step five to finish.
Step 5: Update your nameservers
The final step is updating your nameservers to point to the new website host.
All you need to do is log in to your domain account and go to DNS settings. Here, you should see your nameserver fields. Simply update them to point to your new website host.
You would have received your nameserver details while signing up for a new host in the first step. Just enter the same details here.
It can take up to 24 hours for the domain to be completely propagated to your new host. You can use free DNS checkers online to remain updated on the propagation of the domain to the new host.
Once the propagation is complete and your new host is working fine, you can go ahead and deactivate your old hosting account.
Migrating your WordPress website with a plugin
Migrating a website manually can be a little challenging if you’re not familiar with working with your site’s cPanel.
If this is the case, using a plugin is a better choice. It also takes less time to complete the migration this way. However, you do have to check whether your existing and new hosts are compatible with the migration plugin you’re using.
We will be using All-in-One WP Migration to migrate your WordPress website.
Step 1: Install and activate the plugin
You first need to install and activate the All-in-One WP Migration plugin on your WordPress website.
- Go to Plugins and click on Add new
- Search All-in-One WP Migration. You would be able to see the plugin appear in the search results.
- Download the plugin and activate it.
Step 2: Export your WordPress website
The next step is exporting your current WordPress website using this plugin.
- In your WordPress admin panel, go to All-in-One WP Migration -> Export.
- In the Export to dropdown, select File.
- You would be asked to select the files you’d like to exclude from the export. If you’re not sure, it’s best to leave them as they are.
- The plugin would then start the export of your website. Once the export file is ready, you can download it.
Step 3: Change DNS settings
Now that your export is ready, it’s time to import it to your new website host. Once your new hosting account is ready, install a new version of WordPress on it.
Next, you would need to update your DNS settings.
Simply login into your domain account and update the nameservers to point to your new host. Once the update is complete and the DNS has been propagated, you would see a blank version of WordPress on opening your website.
Step 4: Import your website to the new host
You can now import the same file you exported on your old WordPress website. Here’s how the process works:
- Login to your new WordPress website. You can use the login credentials you used while installing WordPress.
- Install and activate the WP Migration plugin on the new website.
- Navigate to All-in-One WP Migration -> Import from the left panel menu of your WordPress admin panel.
- In the Import From dropdown, select File and upload the file you downloaded earlier.
- Once the upload is complete, you can login to the site with the same credentials you used on the old site. Remember to save your permalinks settings again after logging in.
In case you face an error while uploading your export file, it could be because your host has a size limit for file exports. You can ask your host to update the size limit, or do it on your own by following the steps below:
- Go to your new host’s cPanel account.
- Go to Select PHP Version.
- In the post_max_size and upload_max_filesize fields, increase the size to 128M and try uploading your export file again. If it doesn’t work, you can increase the size to 256M or 512M and check again.
Website migration can seem complicated if you don’t know how the process exactly works.
Once you know the separation between a website’s files and database, and the role of important files like wp-config, you can easily migrate WordPress sites and diagnose issues if you ever run into them.
With this tutorial, you can see how the process works on a file and database level. Even though you can always use plugins to migrate sites, it is important to know how to perform a migration manually, should the need arise.