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

问题描述 投票:0回答:1

我设置了从一个域(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个回答
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>
© www.soinside.com 2019 - 2024. All rights reserved.