A simple and easy path to Migrate WordPress sites to Azure AppService
Published Oct 10 2022 01:21 PM 2,597 Views
Microsoft

Migrating a WordPress website to a new hosting provider or web server can be daunting for many WordPress users. This is understandable since a poorly executed WordPress migration can trigger adverse effects such as downtime and data loss. Fortunately, migrating a WordPress site to another WordPress deployed to Linux App Services, preferably created from Azure Market Place the right way isn’t as complicated as you might think. In addition to the manual method, many tools are available that can help automate most of the process, ensuring a smooth and secure migration.

 

This article will explain 2 ways to migrate a WordPress site running on either Windows App Service or a different hosting provider to a new WordPress on Azure App Service:

  1. With WordPress plugin All-In-One WP Migration
  2. Manual process of migration

Note: Migrate the content to a test instance first, validate all E2E scenarios of your website, and if everything works as expected, swap this instance to the production slot.

 

1. All-In-One WP Migration Plugin

This is a very popular and trusted plugin used for migrating sites with ease and is also recommended by the Azure WordPress team. However, there are certain things that need to be taken care of before starting on the WordPress migration.

This approach is recommended for smaller sites where the content size is less than 256MB. If it is more, you can either purchase the premium version of the plugin, which allows you to bypass the file upload limit, or you can manually migrate the site using the steps outlined in the next section.

By default, the file upload size for WordPress on Linux App Services is limited to 50MB, and it can be increased up to 256MB (Maximum Limit). To change the file upload size limit, you need to add the following Application Settings in the App Service and save it.

Application Setting Name Default Value New Value
UPLOAD_MAX_FILESIZE 50M 256M
POST_MAX_SIZE 128M 256M

 

If you choose to migrate the site using this plugin, install All-In-One Migration plugin on both source and target sites.

 

Export the data at source site:

  1. Launch WordPress Admin page
  2. Open All-In-One WP Migration plugin
  3. Click on 'Export' option and specify the export type as file
  4. This bundles the contents of database, media files, plugins, and themes into a single file, which can then be downloaded.

Import the data at destination site:

  1. Launch WordPress Admin page
  2. Open All-In-One WP Migration plugin
  3. Click on import option on the destination site, and upload the file downloaded in previous section
  4. Empty the caches in W3TC plugin (or any other caches) and validate the content of the site.
    • Click on the Performance option given in the left sidebar of the admin panel to open the W3TC plugin.
    • Then click on the Dashboard option shown below it.
    • On the dashboard, you will see a button with the label Empty All Caches.

 

Recommended Plugins:

After the site migration, it is better to validate that you have the default recommended/ equivalent plugins activated and configured in the right way. If your site rules do not allow to run these plugins, then you can remove the plugins.

  • The W3TC plugin should be activated and configured to use the local Redis cache server and Azure CDN/Blob Storage (if it was configured to use them originally). For more information on how to configure these, please refer to the following documentations:
    Local Redis Cache, Azure CDN, Azure Blob Storage.

  • WP Smush plugin is activated and configured for image optimization. Please see Image Compression for more information on configuration.

 

Recommended WordPress Settings:

The following WordPress settings are recommended. However, when the users migrate their custom sites, is it up to them to decide whether to use these settings or not.

  1. Open the WordPress Admin dashboard.
  2. Set the permalink structure to 'day and name', as it performs better compared to the plain permalinks that uses the format ?p=123.
  3. Under the comment settings, enable the option to break comments into pages.
  4. Show excerpts instead of the full post in the feed.

 

2. Manual Migration Process

The prerequisite is that the WordPress on Linux Azure App Service must have been created with an appropriate hosting plan from here: WordPress on Linux App Service.

 

Export the data at source site:

  1. Download the wp-content folder from the source site. You can use popular FTP tools like FileZilla to connect to the web server and download the content. Depending on the size of your content, it could take sometime. Meanwhile, you can go to the next step to download a copy of your database.

  2. Export the contents of the source database into an SQL file. You can perform this task either using MySQL client tools like HeidiSQL, MySQL workbench, PhpMyAdmin or through command line interface. You can download the MySQL Workbench from here or install phpmyadmin using these steps. For more information on exporting the database, please refer to the following documentation.

 

Import the data at destination site:

  1. Go to SCM site of your WordPress App Service using the following URL.

    https://<sitename>.scm.azurewebsites.net/newui 
    
  2. Open Bash Shell from the menu shown on the top.

  3. Delete the existing content of /home/site/wwwroot/wp-content folder using the following command.

    rm -rf /home/site/wwwroot/wp-content/* 
    
  4. Now upload the new contents of wp-content folder using the File Manager. Click on the label that says 'Drag a File/Folder here to upload, or click to select one'. Please note that if you are not able to upload everything at once, then you can try dividing your upload into multiple smaller ones.

  5. You can integrate your WordPress site to use an existing MySQL database, or use the steps below to migrate the content to the new database server created by the WordPress on Linux App Services offering.

  6. If you chose to migrate the database to newer version, then import the SQL file downloaded from the source database into the database of your newly created WordPress site. You can do it via the PhpMyAdmin dashboard available at <sitename>.azurewebsites.net/phpmyadmin. Please note that if you are unable to import as one single large SQL file, please try to break it into multiple smaller parts and try uploading. Steps to import the database through phpmyadmin are described here.
  7. Launch the Azure Portal and navigate to your App Service -> Configuration blade. Update the database name in the Application Settings of App Service and save it. This will restart your App and the new changes will get reflected.

    Application Setting Name Update Required?
    DATABASE_NAME Yes, replace with the source (exported) database name
    DATABASE_HOST Not Required
    DATABASE_USERNAME Not Required
    DATABASE_PASSWORD Not Required

    Reference: WordPress Application Settings

     

     

     
    RadhikaB_1-1665493724520.png

     

Recommended Plugins:

After the site migration, it is better to validate that you have the default recommended plugins activated and configured right as before. If your site policies do not allow these plugins, then you can remove the plugins from WP-Admin site. 

  • The W3TC plugin or equivalent should be activated and configured to use the local Redis cache server and Azure CDN/Blob Storage (if it was configured to use them originally). For more information on how to configure these, please refer to the following documentations:
    Local Redis Cache, Azure CDN, Azure Blob Storage.

  • WP Smush plugin is activated and configured properly for image optimization. Please see Image Compression for more information on configuration.

 

Recommended WordPress Settings

The following WordPress settings are recommended:

  1. Open the WordPress Admin dashboard.
  2. Set the permalink structure to 'day and name', as it performs better compared to the plain permalinks that uses the format ?p=123.
  3. Under the comment settings, enable the option to break comments into pages.
  4. Show excerpts instead of the full post in the feed.

 

Add PHP extension

Some of the plugins like Woocommerce configured on your website may require specific php libraries and those libraries might not be available out of the box on WordPress environments. Enable the needed php extension to your runtime.

 

Search And Replace (paths and domains)

One common issue that users face during migration is that some of the contents of their old site use absolute urls/paths instead of relative ones. To resolve this issue, you can use plugins like Search and Replace to update the database records.

 

Configuring Custom Domian

If you plan to setup your site with a new Custom Domain please follow the steps described here: Tutorial: Map existing custom DNS name - Azure App Service | Microsoft Docs

 

Migrating Custom Domain

When you migrate a live site and its DNS domain name to App Service, that DNS name is already serving live traffic. You can avoid downtime in DNS resolution during the migration by binding the active DNS name to your App Service app pre-emptively as per the steps described here: Migrate an active DNS name - Azure App Service | Microsoft Docs

 

Updating SSL Certificates

If your site is configured with SSL certs, then we need to redo the setup following the instructions here: Add and manage TLS/SSL certificates - Azure App Service | Microsoft Docs

 

For any further support in migrating your WordPress site you could email us at wordpressonazure@microsoft.com to start a conversation.

2 Comments
Co-Authors
Version history
Last update:
‎Oct 13 2022 12:35 PM
Updated by: