0

我的 IIS 服务器有一个带有 A 记录的子域:

sub.domain.com

IIS 服务器具有 sub.domain.com 的绑定和 *.domain.com 的证书

我们需要的是,当有人访问 sub.domain.com 时,它会将他们带到另一个站点,但会屏蔽 URL 并保留 SSL。目标页面在其 SAN 证书 sub.domain.com 中。

在 Godaddy 上尝试了一个转发,它可以工作,但它不能保留 SSL,我们会遇到证书问题。所以想法是指向我们的服务器以通过 SSL,然后重定向它。我尝试了 URL 重写,但它给出了 404。

网址重写:

    <rewrite>
        <rules>
            <clear />
            <rule name="Pay Redirect" stopProcessing="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTP_HOST}" pattern="^(www\.)?sub\.domain\.com$" />
                </conditions>
                <action type="Redirect" url="https://www.domain2.com/cgsdesktop/PaymentLanding/UniversalPortal" appendQueryString="false" />
            </rule>
        </rules>
    </rewrite>

我只需要知道如何完成这项工作。

4

2 回答 2

0

这个怎么样:

<rules>
    <rule name="Pay Redirect" stopProcessing="true">
        <match url="(.*)" />
        <conditions logicalGrouping="MatchAny">
            <add input="{HTTP_HOST}" pattern="^sub.domain.com$" ignoreCase="true"/>
            <add input="{HTTP_HOST}" pattern="^www.sub.domain.com$" ignoreCase="true"/>
        </conditions>
        <action type="Redirect" url="https://www.domain2.com/cgsdesktop/PaymentLanding/UniversalPortal" appendQueryString="false" />
    </rule>
</rules>

使用sub.domain.com而不是sub\.domain\.com.

本文包含一些有关 IIS 重定向/重写规则的有用方法。

于 2020-06-24T13:34:23.417 回答
0

为了屏蔽 URL 并在浏览器栏中保留 SSL,我们需要创建 URL Rewrite 扩展的 URL Rewrite 动作规则。 但是,URL Rewrite 动作默认只支持将请求重定向到同一个域。将请求重定向到另一个网站时,我们必须安装应用程序请求路由扩展。https://www.iis.net/downloads/microsoft/application-request-routing 否则我们会得到一个 Http 404 错误。 有关详细信息,请参阅我之前的帖子。ASP.net URL 将子目录重写为外部 URL 如果有什么我可以帮助的,请随时告诉我。
在此处输入图像描述





于 2020-06-25T03:18:15.330 回答