我需要在IIS7.5中将"假"子域重定向到真正的子域。原因是营销部门不想在打印件中使用实际的网站地址。

实际网站网址:

reporting.usapartners.com

市场推广部需要 report.usapartners.com (假)至 重定向到 reporting.usapartners.com (真实)

再次,report.usapartners.com 不存在,只reporting.usapartners.com 存在

这是我试过的

我在IIS中添加了一个绑定,用于站点reporting.usapartners.com...我补充说report.usapartners.com 作为主机名,并使用reporting.usapartners.com IP地址

然后我走进reporting.usapartners.com 网络。配置并添加了这个:

<rewrite>
    <rules>
        <rule name="report" stopProcessing="true">
          <conditions logicalGrouping="MatchAll">
            <add input="{HTTP_HOST}" pattern="report.usapartners.com" negate="false" />
          </conditions>
          <action type="Redirect" url="http://reporting.usapartners.com" appendQueryString="false" redirectType="Permanent" />
        </rule>
    </rules>
</rewrite>

看起来我的解决方案创建了一个无法重定向到的别名。

我甚至正确地解决这个问题吗?似乎它应该是一个简单的问题来解决,但也许不是?任何想法都受到欢迎和赞赏。

谢谢

有帮助吗?

解决方案

我认为你需要创建一个单独的网站与主机绑定 report.usapartners.com (假站点)在IIS中。这将是一个存根站点(它仍然需要磁盘上的路径,但它只会有一个 web.config 在那里),这将只是一个重定向规则。

现在点击 HTTP Redirect 对于IIS中的该站点并打勾 Redirect requests to this destination 并把 http://reporting.usapartners.com 在文本框中。然后打勾 Redirect all requests to exact destination (instead of relative to destination), ,不要勾选下一个,然后选择状态代码 Permanent (301).

如果您希望它重定向并保留子目录和/或查询字符串,那么您可以将文本框的内容更改为 http://reporting.usapartners.com$S$Q.请注意,在这种情况下没有尾随斜杠。该 $S 保留子目录和 $Q 保留查询字符串。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top