Design & strategi
Er din SEO strategi opdateret?

Guide to WordPress Migration

Jon Bjørgvinsson

Head of Backend

Læsetid: 10min min.

Udgivet: april 2024

Jon Bjørgvinsson

Head of Backend

Udgivet: april 2024


WordPress migrations vary in complexity based on factors such as custom themes, plugins, and the specific server environments involved. As an experienced WordPress developer, I’ve managed migrations in diverse hosting settings, from shared hosting environments to dedicated VPS servers. This guide will share the practical tools and techniques that I’ve found effective in making WordPress migrations smooth and stress-free.

I know there are tools like All-in-One WP Migration and UpdraftPlus that are very popular, I just don’t have experience with these tools but I’m sure they work well. I will only describe the tools I know. 

Pre-Migration Checklist

PHP Versions

Ensure that the PHP version on your new server matches the one on your old server. Mismatches in PHP versions can lead to deprecated functions, errors, and security vulnerabilities. Before migration, check the PHP version through your hosting control panel or a PHP info file, and adjust the settings on the new server to match.

Match MySQL Versions and Settings

Similar to PHP, differing MySQL versions can affect your site’s database behaviour, potentially leading to errors during data retrieval or storage. It’s important to note that even if these do not match, most of the time migrations will still work fine.

Consistent Environment Settings

Beyond software versions, other environment settings like memory limits (memory_limit), execution times (max_execution_time), and file upload sizes (upload_max_filesize) should be consistent between servers. These settings are typically adjusted in the php.ini file or through the hosting control panel.

Keep a Rollback Plan Ready

Despite all precautions, issues may arise post-migration. Always have a backup and a rollback plan ready so you can revert to the original environment if needed. 

Choosing the Right Tool for the Job

Selecting the right migration tool is crucial to ensuring a smooth transfer. Here are the tools I personally recommend and how to use them.

Using Duplicator Pro/Free for WordPress Migration

Duplicator is a popular WordPress plugin that simplifies the process of migrating a website to a new host or domain. Below are detailed steps to effectively use both the Duplicator Pro and the free version:

Step 1: Install Duplicator

  • Visit the Duplicator website to purchase Duplicator Pro or download the free version directly from the WordPress plugin repository. Install and activate the plugin on your WordPress site.

Step 2: Create a New Package

  • Navigate to the ‘Packages’ section in the Duplicator dashboard on your WordPress site.
  • Click ‘Create New’ and follow the wizard to configure the package. You may encounter warnings during the process; these are generally informational but review them to ensure they won’t impact the build.
  • If the wizard reports errors, resolve these issues before proceeding to build the package.

Step 3: Build the Package

  • Once configured, initiate the package build. This process creates an archive of your site and a script called installer.php. If you encounter errors during the build process, changing the file type to .daf will usually fix the problem. 
  • Optionally, exclude large directories (like a high-volume image folder in a webshop) to reduce the archive size significantly.

Step 4: Download the Archive and Installer

  • After the build completes, download the archive file and the installer.php file to your local machine.

Step 5: Prepare the New Host

  • Update your local machine’s host file to point to the new server’s IP address. This step is crucial for testing the site on the new host before going live. Here’s how to do it:
  • For Windows: Open Notepad as an administrator, navigate to C:\Windows\System32\drivers\etc, and open the hosts file. Add lines for the new IP address and your domain, such as 

1.1.1.1 example.com www.example.com.

  • For Mac: Instructions will vary slightly, involving editing the same file in a different location.

Step 6: Upload Files to the New Server

  • Connect to your new hosting environment using FTP or SFTP.
  • Delete any existing files in the www or public_html directory to prevent conflicts.
  • Upload both the archive file and the installer.php file to the clean directory.

Step 7: Run the Installer

  • Open a browser and go to http://example.com/installer.php.
  • Follow the on-screen instructions to deploy the archive. This will involve setting up database connections and other settings. You might encounter warnings or minor errors, but you can typically proceed unless the installer halts.

Step 8: Finalize the Setup

  • After the installation is complete, log into the WordPress admin panel.
  • Reactivate necessary plugins such as WP Bakery or WP Rocket.
  • If there are issues like redirect problems, update the .htaccess file to the default WordPress settings and adjust the wp-config.php file with your new domain settings using:

define(‘WP_HOME’,’http://example.com’);

define(‘WP_SITEURL’,’http://example.com’);

Step 9: Verify the Site Functionality

  • After restoration, thoroughly check the new site for any issues.
  • Ensure that all necessary plugins are active and functioning as expected

Step 10: Update DNS and Install SSL

  • Update your DNS settings to point the domain A records to the new server IP.
  • Ensure SSL is set up on the new site, utilizing free options like Let’s Encrypt available through most hosting providers.

Step 11: Remove Temporary Changes

  • Once everything is confirmed working, remove the entries added to your host file during Step 5 to revert to normal DNS resolution.

Duplicator Pro also supports multisite installations and local environments like Local by Flywheel, where you can drag and drop the archive for even easier setups. This flexibility makes it a robust tool for various migration scenarios.

Migration Guru for Domain-to-Domain Transfers

Migration Guru is an effective tool for transferring a WordPress site from one domain to another. Below is a structured guide on how to use Migration Guru for a smooth migration process:

Step 1: Prepare Both Sites

  • Ensure that WordPress is installed on both the original site (e.g., example.dev) and the new server. Use a one-click WordPress installer available from most hosting providers to set up WordPress on the new server if it’s not already installed.

Step 2: Install Migration Guru

  • Install the Migration Guru plugin on both the original and new WordPress sites. This plugin can be found in the WordPress plugin repository and is free to use.

Step 3: Generate a Migration Key

  • On the new WordPress site, open Migration Guru and copy the migration key. This key will be used to link the two sites.

Step 4: Start the Migration Process

  • Return to the original site where Migration Guru is also installed.
  • Access the Migration Guru plugin dashboard and select ‘Start Migration’.
  • When prompted to select a host, choose ‘Other’ and enter the migration key you obtained from the new WordPress site and press ‘Start’. 

Step 5: Monitor the Migration

  • The Migration Guru plugin will handle the transfer of files and databases from the old domain to the new one.

Step 6: Address Migration Issues

  • Although Migration Guru is quite reliable, be prepared to troubleshoot any issues that might arise during the migration. Common issues usually relate to file permissions, server configurations, or timeouts.

Step 7: Verify the New Site

  • Once the migration is complete, thoroughly test the new site to ensure everything is functioning correctly. Verify links, images, and plugin functionality.

Step 8: Final Checks

  • Perform a final round of checks to ensure all aspects of the site are operational.
  • Recheck that all services, such as email and subdomains, are configured correctly for the new domain.

Note: Limitations

  • Be aware that Migration Guru does not support migrations to or from localhost environments or within multi-site network subdivisions. For these specific scenarios, alternative tools like Duplicator Pro are recommended.

By following these steps, you can effectively use Migration Guru for domain-to-domain WordPress migrations, making the process straightforward..

WP Staging Pro Migration

WP Staging Pro is a versatile plugin that not only facilitates the creation of staging sites but also simplifies the process of migrating a WordPress site. This guide outlines the steps to use WP Staging Pro for a smooth site migration:

Step 1: Install WP Staging Pro

  • Install WP Staging Pro on your existing WordPress site from which you wish to migrate. You can purchase the Pro version for additional features, or try the free version if it suits your needs.

Step 2: Create a Backup

  • Once WP Staging Pro is installed, use it to create a full backup of your site. This backup will include all your WordPress files and database.

Step 3: Download the Backup

  • After the backup is complete, download the resulting backup file to your local machine. This file will be used to migrate your site to the new server.

Step 4: Prepare the New Server

  • If your new server does not have WordPress installed, use a simple one-click WordPress installer provided by most hosting services to set up a basic WordPress site.

Step 5: Update Your Hosts File (Optional)

  • To test the new site without affecting the live site, you can update your machine’s host file to point to the new server’s IP address. This step allows you to work on the new site without DNS changes.

Step 6: Install WP Staging Pro on the New Site

  • Install WP Staging Pro on the freshly installed WordPress site on the new server.

Step 7: Upload and Restore the Backup

  • Access the ‘Backup and Migration’ section in the WP Staging Pro settings on your new site.
  • Upload the backup file you previously downloaded.
  • Once uploaded, use the WP Staging Pro interface to restore the site from the backup. This will populate your new site with all the data from your old site.

Step 8: Verify the Site Functionality

  • After restoration, thoroughly check the new site for any issues.
  • Ensure that all necessary plugins are active and functioning as expected.

Step 9: Update DNS Settings

  • Once you are satisfied that the new site is functioning correctly, update your DNS settings to point your domain to the new server. This step will make your new site live to all visitors.

Step 10: Install SSL

  • To secure your new site, ensure SSL is configured and activated. Most hosting providers offer a free SSL certificate, like Let’s Encrypt, which can be easily installed via the hosting dashboard.

By following these steps, you can effectively use WP Staging Pro to migrate your WordPress site to a new server, leveraging its capabilities to reduce migration errors and streamline the process.

Manual Migration

Manual migration, while complex, offers complete control over the migration process—a crucial advantage when automated tools fail. This method involves more technical steps such as manual database adjustments and file transfers, which are outlined below:

Step 1: Download Site Files

  • Begin by downloading all files from the www or public_html directory of the site you wish to migrate.

Step 2: Export the Database

  • Access your site’s phpMyAdmin panel.
  • Select the database that your site uses and click on the ‘Export’ tab.
  • Choose the ‘Quick’ export method and the ‘SQL’ format, then click ‘Go’ to download your database.

Step 3: Update the Hosts File (Optional)

  • If you are testing the new site on your local machine or need early DNS resolution, update your machine’s host file to point to the new server’s IP address.
  • This step ensures that when you access your domain, it routes to the new server for testing purposes.

Step 4: Upload Files to the New Server

  • Connect to your new server using FTP or SFTP.
  • Upload all downloaded files into the www or public_html directory of the new server.
  • Ensure that you clear out existing files in this directory before uploading to prevent conflicts.

Step 5: Import the Database

  • Log into the new server’s phpMyAdmin.
  • Select the database you will be using and click on the ‘Import’ tab.
  • Under “File to import,” choose the SQL file you exported earlier and start the import process. This can take a few minutes depending on the size of your database.

Step 6: Update the WordPress URLs

  • Still in phpMyAdmin, locate the wp_options table (this name may have a different prefix than wp_ if you customized it during WordPress installation).
  • Search for the siteurl and home entries in the table. Click the ‘Edit’ link next to each to update them to the new URL of your site.
  • Save the changes to ensure your WordPress site references the new domain.

Step 7: Final Adjustments

  • If you haven’t done so during the upload process, adjust your site’s .htaccess file (for Apache servers) or configure your Nginx settings (for Nginx servers) to ensure permalinks and rewrite rules function correctly.
  • Optionally, adjust the wp-config.php file to ensure database settings are correct and match those of the new server environment.

Step 8: Verify the Site Functionality

  • After migrating the site, thoroughly check the new site for any issues.
  • Ensure that all necessary plugins are active and functioning as expected.

Step 9: Update DNS Settings

  • Once you are satisfied that the new site is functioning correctly, update your DNS settings to point your domain to the new server. This step will make your new site live to all visitors.

Step 10: Install SSL

  • To secure your new site, ensure SSL is configured and activated. Most hosting providers offer a free SSL certificate, like Let’s Encrypt, which can be easily installed via the hosting dashboard.

By following these steps, you can manually migrate your WordPress site to a new server with a high degree of control over the process. This approach is especially useful in situations where automated tools may not be available or suitable.

Conclusion

To wrap up, WordPress migration is about having the right tools and knowing how to use them effectively. Each migration is a learning experience, providing you insights and expertise that you’ll carry into your next project. Happy migrating!

Start dit projekt her

Vi har brug for dine oplysninger, for at kunne hjælpe dig.

"*" indikerer påkrævede felter

Trin 1 af 3

Størrelse på din virksomhed