Click here to Skip to main content
13,192,855 members (54,770 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


1 bookmarked
Posted 12 May 2013

Wordpress Azure Mµ

, 26 May 2013
Rate this:
Please Sign up or sign in to vote.
Wordpress Azure Mµ, Wordpress Multisite on Azure

Editorial Note

This article is an entry in our Windows Azure Developer Challenge. Articles in this sub-section are not required to be full articles so care should be taken when voting. Create your free Azure Trial Account to Enter the Challenge.


Wordpress Azure Mµ is some custom changes to the basic wordpress install, that better take advantage of what Azure offers and to allow Wordpress Multisite on Azure. 

<o:p />


So out of the box azure supports wordpress. That is great but it is missing some great features to full use the power of Azure. Also there are some "bugs/missing features" That need to be addressed. Like it does not work with Wordpress Multisite out of the box. Also it is not setup to use the Azure blob storage or Sql Azure.  

How Azure might benefit the project?   

The benefits of using azure is the scalability and the flexibility. Use azure I don’t have to worry about one site getting slash doted and bring down the whole network.

<o:p />

Let Begin!

To start of create a site and using the Azure gallery create a wordpress site. Just follow the steps boom done! Well not quite… After the install is done, pick what feature you want to add below! 

<o:p />

Custom Changes 

  • Wordpress Multisite with multi-domain support  
    To add multisite add the /* Multisite */ code to your wp-config.php Make sure SUBDOMAIN_INSTALL is false! Next install the WordPress MU Domain mapping plugin this will make the domain name to the right site. Follow the plug steps to move the sunrise.php to the right place afterward add /* for domain mapping */ code to the wp-config.php. Then In the Azure control panel make sure you add all the domain names. Boom Done! You can add sites to your wordpress   
  • Azure blob for storage 
    I really recommend this! To use blog storage to host your image add Windows Azure Storage for WordPress plugin. It is really easy to setup. If you are using multisite do not “Network Activate” That won’t work just enable it on each site.  You can also use the cdn using this plugin!  
  • Stop All The Error Print Outs 
    Php on Azure print all warning and errors. While that is great for debugging it is not good for a site in production. Some pluld will display pgp Notice print outs to turn it off add the line below to the php page;   
    error_reporting(E_ALL ^ E_NOTICE); 
  • Sql Azure for the database (instead of the default of ClearDB)
    • The default setup for wordpress on Azure uses mySql provided by ClearDB. The problem is that the max database size is 20mb.  To setup wordpress to use sqlAzure you need the plugin below
    • Download and unzip the plugin to /wp-content/mu-plugins/
    • Then run:
    • Make sure to select PDO SqlSrv as database type, not “SQL Server using MS PHP Driver” 
  • Cache  with cdn 
     Coming Soon... 

<o:p />

<o:p />

<o:p />

Using the code 

Web.config To Use Multisite

<?xml version="1.0" encoding="UTF-8"?>
                <rule name="WordPress Rule 1" stopProcessing="true">
                    <match url="^index\.php$" ignoreCase="false" />
                    <action type="None" />
                <rule name="WordPress Rule 2" stopProcessing="true">
                    <match url="^([_0-9a-zA-Z-]+/)?files/(.+)" ignoreCase="false" />
                    <action type="Rewrite" url="wp-includes/ms-files.php?file={R:2}" appendQueryString="false" />
                <rule name="WordPress Rule 3" stopProcessing="true">
                    <match url="^([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" />
                    <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" />
                <rule name="WordPress Rule 4" stopProcessing="true">
                    <match url="^" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAny">
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" />
                    <action type="None" />
                <rule name="WordPress Rule 5" stopProcessing="true">
                    <match url="(^[_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" />
                    <action type="Rewrite" url="{R:2}" />
                <rule name="WordPress Rule 6" stopProcessing="true">
                    <match url="^([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" />
                    <action type="Rewrite" url="{R:2}" />
                <rule name="WordPress Rule 7" stopProcessing="true">
                    <match url="." ignoreCase="false" />
                    <action type="Rewrite" url="index.php" />
              <requestLimits maxAllowedContentLength="104857600" /> <!--100 MB-->

 wp-config.php  Add this for multisite   

/* Multisite */
define('WP_ALLOW_MULTISITE', true);
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
$base = '/';
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

 Add After  WordPress MU Domain Mapping is installed 

/* For domain mapping */
define( 'SUNRISE', 'on' );  
Add TO Plugins That print errors.
error_reporting(E_ALL ^ E_NOTICE);


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

CEO Helix Ten
United States United States
I am the creator of last year contest winning app Loclville. I have been programming for 10+ years. I work as a software engineer at Sony Picture Imageworks. (One of the world largest effects house.) JavaScript and Python are my strongest languages, but I also use php and c#. I have created few app in the app stores for Windows 8, 7, Windows Phone, iOS, Android and Blackberry.

You may also be interested in...


Comments and Discussions

-- There are no messages in this forum --
Permalink | Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.171017.2 | Last Updated 27 May 2013
Article Copyright 2013 by HelixTen
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid