Was wondering if anybody could help. Thanks so much!
Problem:
- blog.example.com
-
cool.example.com
redirect to https://www.example.com
Goal:
We’re trying to only redirect
Current code
Current code in web.config is this. Stuck on <match url="(.*)">
Below is rest of rewrite rule.
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to https">
<match url="(.*)" />
<conditions>
<add input="{SERVER_PORT}" pattern="443" negate="true" />
</conditions>
<action type="Redirect" url="https://www.example.com" />
</rule>
</rules>
</rewrite>
<modules runAllManagedModulesForAllRequests="true"/>
<defaultDocument enabled="true">
<files>
<clear/>
<!--Remove this line or place below to deprecate-->
<add value="default.aspx"/>
<add value="index.html"/>
<add value="index.php"/>
<add value="default.html"/>
</files>
</defaultDocument>
Modify
<match url="(.*)" />to include onlyexample.comandwww.example.com– right now you’re matching all urls.http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module/