I've been using the following pattern to set up directory structure for my main site and subdomains:
A. Each site is in its own subfolder, including the main site so that I have something like
\wwwroot
\main
\subdomain1
B. There's only 1 file in wwwroot. A web.config file with the following
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<rewrite>
<rules>
<rule name="Rewrite to folder1" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.MyMainDomain.com$" />
</conditions>
<action type="Rewrite" url="main/{R:1}" />
</rule>
<rule name="subdomain1.MyMainDomain.com to sub folder" enabled="true" stopProcessing="true">
<match url="(.*)" ignoreCase="true" />
<conditions logicalGrouping="MatchAll">
<add input="{HTTP_HOST}" pattern="^subdomain1\.MyMainDomain\.com$" ignoreCase="false" />
<add input="{PATH_INFO}" pattern="^/subdomain1($|/)" negate="true" />
</conditions>
<action type="Rewrite" url="\subdomain1\{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
How do I add https redirect to only the subdomain?
What's the best way to debug what is being rewritten/redirected?