像这样的东西应该工作:
<rule name="Primary hostname redirect" stopProcessing="false">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^quietincomes.com$" />
</conditions>
<action type="Redirect" url="http://www.quietincomes.com/{R:0}" redirectType="Permanent" />
</rule>
<rule name="www.shayam redirect" stopProcessing="false">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^www.shayam.quietincomes.com$" />
</conditions>
<action type="Redirect" url="http://www.quietincomes.com/shayam/{R:0}" redirectType="Permanent" />
</rule>
<rule name="shayam redirect" stopProcessing="false">
<match url=".*" />
<conditions>
<add input="{HTTP_HOST}" pattern="^shayam.quietincomes.com$" />
</conditions>
<action type="Redirect" url="http://www.quietincomes.com/shayam/{R:0}" redirectType="Permanent" />
</rule>
如果您希望子域部分是动态的,像这样(还没有测试过!):
<rule name="Dynamic redirect" stopProcessing="false">
<match url="^(.*)\.quietincomes\.com$" />
<conditions>
<add input="{HTTP_HOST}" pattern="^(.*)\.quietincomes\.com$" />
</conditions>
<action type="Redirect" url="http://www.quietincomes.com/{C:1}/{R:0}" redirectType="Permanent" />
</rule>
匹配规则指定在重定向 url ({C:1}) 中使用的反向引用 (.*)