如何根据此
在webconfig中实现重定向规则在http://www.shyam.quietincomes.com .....这个shyam是动态创建的.. 它可以是www.harshit.quietincomes.com,www.ankush.quietincomes.com
答案 0 :(得分:1)
这样的事情应该有效:
<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>
匹配规则指定在重定向网址({C:1})中使用的反向引用(。*)