IIS重写使用IISpipe理器

您好,我试图做一个适当的IIS重写利用我的托pipe服务提供商给我的IISpipe理器凭据。 我没有这方面的经验,到目前为止我在网上阅读的文章都没有太大的帮助。

这里是场景:我有一个ASP.net MVC 5网站( reallylongmaindomain.com ,为了便于阅读),物理上有file upload到它。 它使用SSL证书进行保护。 我们发布的文献有一个较短的域名(不是URL缩短的域名),我们称之为shortdomain.com ,它没有任何文件。 但是,如果您导航到shortdomain.com ,则会出现SSL域名不匹配错误(准确地说,ERR_CERT_COMMON_NAME_INVALID)。 这是我需要避免的。

在来的IIS经理。 我已成功login到系统并添加了URL重写。 这是我有的规则: (http(s)?://)?(www.)?shortdomain.com 。 这将处理用户可能放在地址栏中的任何http/https和/或www 。 操作属性设置为“redirect”(永久301),redirectURL设置为https://reallylongmaindomain.com ,但我仍然收到SSL证书错误,窗口中的URL仍然是shortdomain.com

我相信我只是错过了一两件简单的事情。 我是否也需要将规则添加到我的Web.Config文件中? 我以为IISpipe理器规则取代了Web.Config规则。 编辑 :规则被添加到我的web.config,这里是:

  <rewrite> <rules> <rule name="site redirect" stopProcessing="true"> <match url="(http(s)?://)?(www.)?shortdomain.com" /> <action type="Redirect" url="https://reallylongmaindomain.com" /> </rule> </rules> </rewrite> 

谢谢!

原来,这是我正在寻找的规则:

 <rewrite> <rule name="redirect" stopProcessing="true"> <match url=".*" /> <conditions> <add input="{HTTP_HOST}" pattern="^(.*)?shortdomain.com" /> </conditions> <action type="Redirect" url="https://reallylongmaindomain.com/{R:0}" /> </rule> </rewrite> 

应用此规则后,导航到shortdomain.com解决完全罚款https://reallylongmaindomain.com

希望这可以帮助别人!