安装了多个证书的SSLredirect的最佳IISconfiguration

我有安装了通配符SSL证书的IIS7 / WinServer2008configuration(* .mydomain.com)。 Web服务器拥有多个网站,每个网站都configuration为通过主机标题从相同IP(称为IP1)路由。 有些网站被configuration为使用SSL,而有些则不是。

所以我有…

a.mydomain.com -> SSL b.mydomain.com -> non-SSL c.mydomain.com -> SSL d.mydomain.com -> non-SSL e.mydomain.com -> non-SSL 

等等…

对于上面的示例站点A和C(SSL站点),我希望标准HTTP URL可以redirect到HTTPS。 所以在IIS的根目录(红色箭头),我已经通过添加一个自定义的状态代码403.4(见下面的设置)configuration了错误页面设置。

添加了客户403.4状态码

编辑设置对话框

编辑功能设置对话框

redirectHttpToHttps.htm文件的内容是…

 <html> <head><title>Redirecting...</title></head> <script language="JavaScript"> function redirectHttpToHttps() { var httpURL= window.location.hostname + window.location.pathname + window.location.search; var httpsURL= "https://" + httpURL; window.location = httpsURL; } redirectHttpToHttps(); </script> <body> </body> </html> 

然后,对于A和C站点,我用SSL绑定(专门路由到IP1)replace旧绑定,并将SSL设置设置为“需要SSL”。

所以一切都很好。 网站A将http://a.mydomain.comredirect到https://a.mydomain.com ,类似的,网站C也做同样的事情。

现在我有一个非通配符SSL证书来引入混合。 这是为了绑定到aaa.customerdomain.com的网站。 所以我将证书添加到我的IIS服务器上,并更改了aaa.customerdomain.com站点的绑定,以使用新绑定的SSL绑定和新的IP2绑定。

所以现在如果我导航到https://aaa.customerdomain.com ,一切都很好。 但是,我不知道如何让http://aaa.customerdomain.comredirect到SSL版本。

有人可以帮助我正确的方式来configurationIIS,所以我可以使所有这些工作?

在IIS中处理各种types的redirect尝试使用url重写模块

http://www.iis.net/downloads/microsoft/url-rewrite

然后添加这个在webconfiguration每个网站的HTTP到httpsredirect:

 <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions><add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="SeeOther" /> </rule> 

您也可以使用GUI通过IIS url重写模块接口完成此操作: 在这里输入图像说明在这里输入图像说明