Installing WordPress Multi-site Sub-Directory Within A Sub-folder On IIS/Azure
-
Has anyone successfully able to get a WP Multisite using the sub-directory method working when its installed inside a subfolder and not root? For example it would be installed like:
/root/sites/
https://www.mywebsite.com/sitesThat way I can create all my multisites sites and their urls would be like:
https://www.mywebsite.com/sites/test-site-1
https://www.mywebsite.com/sites/test-site-2I think it’s possible and its only a matter of configuring the web.config. By default, WP provides the following and to put these rules in /sites/web.config:
<rule name="WordPress Rule 1" stopProcessing="true"> <match url="^index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^sites/([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> </rule> <rule name="WordPress Rule 3" 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" /> </conditions> <action type="None" /> </rule> <rule name="WordPress Rule 4" stopProcessing="true"> <match url="^sites/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="sites/{R:1}" /> </rule> <rule name="WordPress Rule 5" stopProcessing="true"> <match url="^sites/([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> <action type="Rewrite" url="sites/{R:2}" /> </rule> <rule name="WordPress Rule 6" stopProcessing="true"> <match url="." ignoreCase="false" /> <action type="Rewrite" url="index.php" /> </rule>
Which I think is close, but its assuming that the website may be in root? Putting the rules in /sites/web.config appears to make no difference. So I’ve been putting the rules following modified rules within the root web.config. Here’s my modification but still not working.
<rule name="WordPress Rule 1" stopProcessing="true"> <match url="^sites/index\.php$" ignoreCase="false" /> <action type="None" /> </rule> <rule name="WordPress Rule 2" stopProcessing="true"> <match url="^sites/([_0-9a-zA-Z-]+/)?wp-admin$" ignoreCase="false" /> <action type="Redirect" url="{R:1}wp-admin/" redirectType="Permanent" /> </rule> <rule name="WordPress Rule 3" 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" /> </conditions> <action type="None" /> </rule> <rule name="WordPress Rule 4" stopProcessing="true"> <match url="^sites/([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*)" ignoreCase="false" /> <action type="Rewrite" url="sites/{R:1}" /> </rule> <rule name="WordPress Rule 5" stopProcessing="true"> <match url="^sites/([_0-9a-zA-Z-]+/)?([_0-9a-zA-Z-]+/)?(.*\.php)$" ignoreCase="false" /> <action type="Rewrite" url="sites/{R:2}" /> </rule> <rule name="WordPress Rule 6" stopProcessing="true"> <match url="sites/." ignoreCase="false" /> <action type="Rewrite" url="sites/index.php" /> </rule>
I can get to the Multisite dashboard and everything within the admin is working for /sites/ but I’m not able to see the website of websites (test-site-1 and test-site-2) I created nor access their dashboard.
I’m doing this on Azure, but it would be similar to IIS if not the same. I can also confirm that there is no rules conflict with any other rules.
Any help would be appeciated
- The topic ‘Installing WordPress Multi-site Sub-Directory Within A Sub-folder On IIS/Azure’ is closed to new replies.