我想重定向(301)所有流量使用web.config
规则一个新的领域,但该网站也被处理子域也将需要重定向的越来越多。
我怎样写为下面的规则?
a.foo.com -> a.bar.org
b.foo.com -> b.bar.org
c.foo.com/some-page -> c.bar.org/some-page
d.foo.com/some/other/page -> d.bar.org/some-page
基本上像this但IIS。
这是我尝试到目前为止:
<rule name="redirect" enabled="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true" pattern="^(.*)\.foo\.com$" />
</conditions>
<action type="Redirect" url="http://{C:1}.bar.org/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
啊,我终于得到了它的工作:
<rule name="redirect" enabled="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="false" pattern="^(.*)\.foo\.com" />
</conditions>
<action type="Redirect" url="https://{C:1}.bar.org/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
我不完全理解的规则,但:/这并不没有如“否定”设置为false工作。