Moving WordPress to a subsite in Azure Websites

Deploying WordPress in Azure is relatively straightforward.  Deploy a Resource Group, with a DB, and a Web Server using the WordPress template and bob is your fathers brother.

However, I wanted to move WP to a subdomain which all in all should be pretty straight forward. All the instructions online are out of date or for different systems though, so I wanted to note what I had to set to get it all working.

General Steps are:

1) Deploy your WordPress site.

2) Go into the WP site and perform the configuration to get it running bare-bones

3) Go back into the Azure Portal and find the FTP configuration

4) Log into the Website with the FTP credentials (I used WinSCP)

5) Copy the entire WordPress site to your local machine

6) Delete everything from your site except for
I had a few problems deleting the wp-admin and wp-content folders – it kept blocking access, but went eventually.

7) Create the name of the subfolder you want to use (in my case /d/)

8) Copy the backup of your WordPress into the subfolder.

9) Edit the root web.config file.  Mine is setup to redirect all traffic to the /d/ folder.  You many a different setup, but this is mine:
<?xml version=”1.0″ encoding=”utf-8″?>
            <rule name=”Root Hit Redirect” stopProcessing=”true”>
                <match url=”^$” />
                <action type=”Redirect” url=”/d/” />

 10) Edit the root index.php file and change the require
require( dirname( __FILE__ ) . ‘wp-blog-header.php’ );
to include the sub folder you want to use.
require( dirname( __FILE__ ) . ‘/d/wp-blog-header.php’ );

11) Azure WordPress seems to ignore the SQL database setting for the site and home name.  Therefore this must be hardcoded in the wp-config.php file.
Replace the existing paths BELOW the Stop Editing Line! as follows.

define(‘WP_CONTENT_URL’, ‘’);

I also had to define the WP_CONTENT_URL string as my Salient theme wasn’t picking up the subpath for some reason, so I hard coded it.

12) The only thing you may have to do is edit the subfolders web.config file.   I was having loads of errors, until I deleted it, then it magically started working.  However, it does seem to have been replaced with an empty web.config file, so its contents are here:
<?xml version=”1.0″ encoding=”UTF-8″?>


I think that was about it, but it was quite the pain to get it configured.  Nb, if you change the website name or add a custom domain, don’t forget you’ll have to change the wp-config.php with the new domain name as Azure won’t do this for you automatically.

I’m also not sure how things will go when there is a new version available, but hopefully this will get you going.