【问题标题】:How to Redirect a Domain without Changing the URL in web.config file?如何在不更改 web.config 文件中的 URL 的情况下重定向域?
【发布时间】:2019-04-17 16:33:35
【问题描述】:

我设置了从一个域 (https://test.mydomain.com) 到另一个 URL (http://testing.com/test/Login.aspx) 的重定向,并且我想将域名保留在地址栏中。基本上,将网站访问者重定向到另一个站点,但不向他们显示目标地址,因此他们不知道重定向。

这是针对运行 iis 7 的 windows server 2008 r2。我想修改 web.config 文件。

我希望重定向保留原始域 (https://test.mydomain.com)。

【问题讨论】:

标签: redirect iis-7


【解决方案1】:

根据你的描述,我建议你使用URL Rewrite
先添加条件判断URL是否为https请求,再添加条件判断URL的域。将以下规则添加到您的 web.config 文件中。

<rule name="test url rewrite">
    <match url="(.*)" />
    <conditions>
        <add input="{HTTPS}" pattern="on" />
        <add input="{HTTP_HOST}" pattern="test.mydomain.com" />
    </conditions>
    <action type="Rewrite" url="http://testing.com/test/Login.aspx" />
</rule>

【讨论】:

    猜你喜欢
    • 2013-08-11
    • 2017-02-16
    • 1970-01-01
    • 1970-01-01
    • 2012-05-22
    • 1970-01-01
    • 2020-11-04
    • 2010-11-02
    • 1970-01-01
    相关资源
    最近更新 更多