IIS 7 Multi-Domain Home Page Canonical Forwarding

In our web.config file, we control 6 different international domains.

How can we do the following with 1 rule:

Redirection

  • www.1of6Domains.com/index.htm
  • www.1of6Domains.com/index.html
  • www.1of6Domains.com/default.asp
  • www.1of6Domains.com/default.aspx

to

  • www.1of6Domains.com

Something like that?

<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> 
+6
source share
1 answer

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, say, www.1of6Domains.com you mean that each domain can be different, then the action should be (remember that it does not involve https traffic): <action type="Redirect" url="http://www.1of6Domains.com" />

EDIT: Here are the rules for processing multiple domains (maybe with one rule, but you need to create a rewrite map, not sure if you want this 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> 
+2
source

All Articles