Blog Post

Apps on Azure Blog
3 MIN READ

How to set up subdirectory Multisite in WordPress on Azure App Service

abhishekreddy's avatar
abhishekreddy
Icon for Microsoft rankMicrosoft
Apr 10, 2023

Try WordPress on Azure App Service here:

Deploy to Azure

 

What is WordPress Multisite?

 

WordPress Multisite is a feature of WordPress that enables you to run and manage multiple WordPress websites using the same WordPress installation. You could update multiple websites in a single click by using the parent WordPress dashboard, and even manage individual sites through their individual dashboards. This feature was previously called WordPress Multi-User.

 

For example, a multinational e-commerce store can create multiple country-specific subsites in the same WordPress installation using this feature. The root admin can install plugins and themes required for all the websites at once. They can also assign different admins to each subsite. A lot of our customers use the multisite feature for various scenarios. Universities use WordPress multisite to create websites for different departments and student clubs; retail store chains use this feature to create different websites for each store location; and real estate developers use different websites for each project.

 

In this article, we will go through an easy, step-by-step approach to creating a WordPress multisite setup on Azure App Service. We can enable WordPress both during the deployment of a WordPress website on Azure App Service as well as after the website has been deployed.

 

Note: These following steps work for subdirectory style multisite. If you need subdomain (or multidomain) style multisite setup, see How to set up subdomain Multisite in WordPress on App Service - Microsoft Community Hub

 

Step 1: Create a WordPress website on App Service as explained in How to set up a new WordPress website on Azure App Service - Microsoft Community Hub. If you already have a WordPress website on App Service, skip this step.

 

Step 2: Go to App Service Resource Page. Click on Configuration on the left panel. 

 

Step 3: You will see a list of application settings with Name, value, source, deployment slot setting and options to delete and edit.  

Search for the following application settings and edit: 

(If you cannot find these application settings, please add these application settings by using the + New application setting button and add these settings.)

Application Settings 

Value 

WORDPRESS_MULTISITE_CONVERT 

true 

WORDPRESS_MULTISITE_TYPE 

subdirectory 

 

Then click on the Save button to save the application settings. 

 

Step 3: Wait for the WordPress server to restart with the multisite settings enabled. Then go to the Admin Dashboard of the WordPress website. Then Go to Plugins. You will see that for every plugin, you will need to activate them for the network. Click on Network Activate for W3 Total Cache and Smush to take advantage of out of box features by WordPress on Azure App Service. 

 

Step 4: In the top left corner of the page, you can see My Sites. Go to My Sites > Network Admin > Sites 

 

Step 5: Click on Add New button to add new sites. 

 

Step 6: Fill in the required details and click on Add Site. Repeat this for as many sites as you need. 

 

Step 7: You can see the list of all sites in the All Sites option on the left pane. 

 

Each site has its own Dashboard to manage. Try this feature out and let us know what you think. 

Support and Feedback 

In case you need any support, you can open a support request at New support request - Microsoft Azure.

 

For more details about the offering, please visit Announcing the General Availability of WordPress on Azure App Service - Microsoft Tech Community.

 

If you have any ideas about how we can make WordPress on Azure App Service better, please post your ideas at Post idea · Community (azure.com)

 

or you could email us at wordpressonazure@microsoft.com to start a conversation.

Updated Jul 28, 2023
Version 3.0
  • Brandon_Hammond's avatar
    Brandon_Hammond
    Copper Contributor

    Once these steps were followed we were able to create subdirectory sites but users were stuck in a redirect loop when attempting to access the dashboard for subdirectory network sites.  Since the new WordPress Azure app uses nginx we needed to make the following updates:

     

    1.  Create a nginx.conf file based on the file found at /etc/nginx/conf.d/default.conf and place it in /home/site/wwwroot

     

    2.  Add the lines necessary for multisite directly below 'index index.php;' on line 14.  We used an FTP client for this.

    if (!-e $request_filename) {
      rewrite /wp-admin$ $scheme://$host$request_uri/ permanent;
      rewrite ^(/[^/]+)?(/wp-.*) $2 last;
      rewrite ^(/[^/]+)?(/.*\.php) $2 last;
    }

     

    3. Update /dev/startup.sh to contain:

    cp /home/site/wwwroot/nginx.conf /etc/nginx/conf.d/default.conf
    /usr/sbin/nginx -s reload

     

    4. Stop and start the app to load the new configuration (or run the commands from 3 in the SSH terminal)

     

    We referenced this document for the multisite configurations: Nginx – Advanced Administration Handbook | Developer.WordPress.org  and this document for how to update the app's nginx configuration: wordpress-linux-appservice/WordPress/configuring_nginx_for_wordpress.md at main · Azure/wordpress-linux-appservice · GitHub

  • Rafalorente's avatar
    Rafalorente
    Copper Contributor

    Is it possible to set the variable WORDPRESS_MULTISITE_TYPE with the value "subdomain"?, to implement the wordpress subdomain option?

  • Hi Rafalorente,

     

    Thank you for the question.


    There are a few additional steps that you might have to take in order for the subdomain or the different domains to work, apart from setting the variable to 'subdomain' as you mentioned. We will be releasing another document shortly - explaining the steps how to set up a subdomain style multisite. If you need any specific information, please email us at wordpressonazure@microsoft.com and we will get back to you.

  • mlowery-aci's avatar
    mlowery-aci
    Copper Contributor

    Hi abhishekreddy - I followed the above steps to install a new instance of Wordpress on App Service, with Enable Multisite checkbox selected, and when I logged into the Wordpress dashboard, there was no multisite option (My Sites, Network Admin, etc).

     

    These application settings are already present in my instance.

     

    Application Settings 

    Value 

    WORDPRESS_MULTISITE_CONVERT 

    true 

    WORDPRESS_MULTISITE_TYPE 

    subdirectory 

  • HCOEweb's avatar
    HCOEweb
    Copper Contributor

    I am having the same problem mlowery-aci had...have added those Application settings and no change happens to the WordPress dashboard. I have even tried also adding the line to wp-config.php that one normally would do in a non-Azure environment.

     

    Is there a certain level of plan that is required for a Multisite installation? The site I'm trying to use it on is currently on the Basic pricing tier.