我的情况是我们的客户端使用负载平衡运行基于Umbraco的网站,我们有以下规则将请求重定向到所有这些服务器到主域“https://www.ourclient.co.uk”。
这是重定向的代码:
<!-- Canonicalize all domains to a single domain -->
<rule name="SEO - http canonical redirect" stopProcessing="true" enabled="false">
<match url="(.*)"/>
<conditions logicalGrouping="MatchAll" trackAllCaptures="false">
<add input="{HTTP_HOST}" pattern="^www\.ourclient\.co\.uk" negate="true"/>
<add input="{HTTP_HOST}" pattern="^admin\.ourclient\.co\.uk" negate="true"/>
<add input="{HTTP_HOST}" pattern="^01-live\.ourclient\.co\.uk" negate="true"/>
<add input="{HTTP_HOST}" pattern="^02-live\.ourclient\.co\.uk" negate="true"/>
<add input="{HTTP_HOST}" pattern="^03-live\.ourclient\.co\.uk" negate="true"/>
<add input="{HTTP_HOST}" pattern="^04-live\.ourclient\.co\.uk" negate="true"/>
</conditions>
<action type="Redirect" url="https://www.ourclient.co.uk/{R:1}"/>
</rule>
现在我需要实现的是,https://www.ourclient.co.uk/umbraco/的任何请求都被重定向到https://admin.ourclient.co.uk/umbraco/,但对于我的生活,我无法获得任何工作。
我们非常欢迎任何有关解决方案的帮助,以及对我的帖子的任何更正。
答案 0 :(得分:0)
只需添加新规则。
<rules>
<rule name="SEO - http canonical redirect">
... your old stuff ... but exclude the admin.yourclient.com/umbraco (!)
</rule>
<rule name="redirectUmbracoToAdminSite">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" pattern="^yourclient\.com$" negate="true" />
<add input="{REQUEST_URI}" matchType="Pattern" pattern="^umbraco" ignoreCase="true" negate="false" />
</conditions>
<action type="Redirect" url="http://admin.yourclient\.com/{R:1}" />
</rule>
</rules>