I have an IIS7 web server with several sites running. Some of the sites are sub-domains of one domain and the others are totally separate domains. I want to use IIS re-write to redirect all the sub domain sites of one domain to https, but I want the other domains left as they are. For example I have the following sites on the same web server:
one.test.com, two.test.com, otherdomain.com
And I want to setup a global IIS rewrite to redirect http://one.test.com and http://two.test.com to https, but otherdomain.com should not be affected.
Here is what I have so far, and when I've tested the regex it seems correct but it is not redirecting the subdomain sites:
<rewrite>
<globalRules>
<rule name="Redirect to HTTPS" enabled="true" stopProcessing="true">
<match url="(.*)(\.test\.com)" />
<conditions logicalGrouping="MatchAny">
</conditions>
<action type="Redirect" url="https://{R1}{R2}" redirectType="SeeOther" />
</rule>
</globalRules>
</rewrite>
Am I over complicating this or missing something obvious?
Cheers.