Several root directories indicating a domain must indicate subfolders according to the domain name in web.config

I have three domains domain1.com , domain2.com and domain3.com all pointing to my azure web application mysites.azurewebsite.net . In my root folder on the azure website, three folders are available domain1 , domain2 and domain3 with wordpress installed in these folders. Currently, I have specified the options below in my web.config and points to the corresponding folders.

  <rule name="domain1" stopProcessing="true"> <match url=".*"/> <conditions logicalGrouping="MatchAny"> <add input="{HTTP_HOST}" pattern="^(www.)?domain1.com"/> </conditions> <action type="Rewrite" redirectType="Permanent" url="\domain1\{R:0}" /> </rule> <rule name="domain2" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^(www.)?domain2.com" /> <add input="{PATH_INFO}" pattern="^/domain2/" negate="true" /> </conditions> <action type="Rewrite" url="\domain2\{R:0}" /> </rule> <rule name="domain3" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^(www.)?domain3.com" /> <add input="{PATH_INFO}" pattern="^/domain3/" negate="true" /> </conditions> <action type="Rewrite" url="\domain3\{R:0}" /> </rule> 

The problem that I am encountering while I click on any subpage link that will be displayed below the error

 The resource you are looking for has been removed, had its name changed, or is temporarily unavailable. 

When I disconnect the friendly URL (permalink) from my Wordpress admin, then it works fine. But it appears as mydomain.com/?page_id=1 for the About Us page.

How can I make it work after changing the permalink to a friendly url like mydomain1.com/about-us

It does not work due to the fact that each subfolder has wordpress, and in wordpress I have included a permalink. Otherwise it works fine

+6
source share
1 answer

I don’t have a complete answer for you, but stopProcessing = "true" for each rule can cause you some grief because it stops processing the rules further, so your secondary and third rules will be ignored when you set this flag in the first rule.

You also have your own pattern matching "* \" for all three rules, so perhaps this rule might work:

 <rules> <rule name="Domain2"> <match url="*.domain2.*" /> <conditions> <add input="{UrlDecode:{QUERY_STRING}}" pattern="domain2" /> </conditions> <action type="Rewrite" url="{HTTP_HOST}/domain2/" /> </rule> </rules> 
+3
source

All Articles