In our web.config file we control 6 different international domains.
How do we do the following with 1 rule:
Redirect
to
Something like this?
<rule name="Canonical Redirect" enabled="true" stopProcessing="true">
<match url="(.*)/(index.html|index.htm|default.asp|default.aspx)" />
<conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
<action type="Redirect" url="{R:1}" />
</rule>
I would go with:
<rule name="Canonical Redirect" enabled="true" stopProcessing="true">
<match url="^index.html$|^index.htm$|^default.asp$|^default.aspx$" />
<action type="Redirect" url="/" />
</rule>
If by saying www.1of6Domains.com you mean each domain might be different then action must be (bear in mind that it assumes non https traffic):
<action type="Redirect" url="http://www.1of6Domains.com" />
EDIT: Here are the rules to handle multiple domains (it's possible with one rule, but rewrite map would need to be created, not sure you want that complication):
<rule name="Canonical Redirect Non Https">
<match url="^index.html$|^index.htm$|^default.asp$|^default.aspx$" />
<action type="Rewrite" url="http://{HTTP_HOST}/" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
</rule>
<rule name="Canonical Redirect Https">
<match url="^index.html$|^index.htm$|^default.asp$|^default.aspx$" />
<action type="Rewrite" url="https://{HTTP_HOST}/" />
<conditions>
<add input="{HTTPS}" pattern="^ON$" />
</conditions>
</rule>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With