如何在不更改web.config文件中URL的情况下重定向域?

时间:2019-04-17 16:33:36

标签: redirect iis-7

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

这是用于运行iis 7的Windows Server 2008 r2。我想修改web.config文件。

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

1 个答案:

答案 0 :(得分:0)

根据您的描述,我建议您可以使用urlrewrite,首先可以添加条件以检查url是否为https reuqest,然后可以添加另一个条件以检查url的域。您可以在下面添加webconfig文件。

<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>
相关问题