How to Move Your WordPress Site to Microsoft Azure: Step by Step Guide
We recently looked at Microsoft’s cloud service Azure where we gave an introduction to the service and how to setup a fresh WordPress installation. Today we are going to look at how to move an existing WordPress website over to Azure. The steps covered will be how to backup your existing WordPress installation, move your site content and WordPress files over to Azure and to setup your permalinks so they are the same.
In partnership with Microsoft
Backup your WordPress Site with cPanel
The first step when moving any website should be to make sure you have a complete and current backup of your site should anything go wrong and to ensure you are moving the freshest version of your site so no content, comments or other data is lost in the move. There are a number of ways to achieve this, if you are currently using cPanel on your current host this is really easy to accomplish. Simply login to your cPanel and choose the “Backup Wizard” link and then choose the “Backup” option:
Choose the “Full Backup” option which will include all your files and databases:
Finally, enter your email address and click the “Generate Backup” link and you will receive an email once the backup has completed.
Article Continues Below
Backup your WordPress Site with a Plugin
If you do not use cPanel hosting, your host may have a different procedure for generating backups. For a method that will work with any host, you can use the plugin BackupWordPress which is free to download.
Install and activate the plugin and you will see a new menu item under “Tools” named “Backups”,click the “Settings” link and choose the “Database and Files” option.
Now you can click “Run Now” which will create a backup of your site, once it has finished running ( the amount of time will depend on the size of your database and site content ) you can then download the backup as a zip file.
Export Your Site Content
Now you have your site files you will need a copy of your site content, WordPress has a built-in exporter for this – simply visit “Tools” > “Export” and choose “All Content” and download the Export file.
Move WordPress Content to Azure
Now you have your site backup, the content you will need to set the site up on Azure is as follows :
- The /wp-content folder – This contains any uploaded images and files, your plugins and your themes
- The Export file – This contains all your blog posts, comments, pages and any other content.
In our previous post, we showed you how to install WordPress on Azure so you should make sure you have done that correctly and have a functioning WordPress installation before proceeding. In this step we will be uploading our wp-content folder via FTP and importing the database.
Upload Content Via FTP
Login to Azure portal and choose your website from the “Websites” link on the left-hand side, click your site name and the “Dashboard” and you will see a link on the bottom right named “Setup Deployment Credentials” :
Enter a username and password in the popup box and these will be your FTP login credentials ( you can also use these with GIT if you prefer to deply that way ).
Scroll down and you will see the FTP hostname to use, I entered my username as “wplift” but when logging in via FTP I have to enter it as follows : wplift\wplift along with the password you chose – you can then login with any FTP program such as Filezilla, navigate to : site/wwwroot/ and you can then upload your wp-content folder.
Import Content
To import your content, in the new Azure installation visit “Tools” > “Import” and select the WordPress importer from the list :
This will bring up the WordPress importer plugin, click “Install” and then activate the plugin
You can then upload the XML file you exported from your original site:
Make sure you tick the “Download and import file attachments” box as this will grab all the images from your old site.
Once this has finished, you can now activate your original theme and plugins and you should have a complete copy of your old site running in Microsoft Azure.
Permalinks
To make sure there are no 404 page not found errors, you should set your permalinks up the same as the previous site. To do this visit “Settings” > “Permalinks” and choose your option there. For instance, choose “Post Name” and WordPress will create a “web.config” file for you ( on PHP hosting, the file is .htaccess ) and will contain the following :
[php]<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="wordpress" patternSyntax="Wildcard">
<match url="*"/>
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
</conditions>
<action type="Rewrite" url="index.php"/>
</rule></rules>
</rewrite>
</system.webServer>
</configuration>[/php]
Following these steps you will see it’s actually very easy to move a WordPress installation over to a different hosting environment – taking a full site backup is essential though should you run into any problems along the way. Using the WordPress Import / Export tool helps greatly with this and FTP was nice and simple to setup using the Azure interface.