我在GoDaddy上托管了两个域:
www.mymaindomain.com
www.mysecondarydomain.com
主域存储在根ftp文件夹中,次域存储在单独的文件夹"second“中。我已经为我的主域购买了SSL证书,并在web.config中应用了http到https重定向,如GoDaddy帮助中所述:
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)"></match>
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true"></add>
</conditions>
<action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}/{R:1}"></action>
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
问题是,到第二个域的流量也会被重定向到https,并且用户会收到安全警报。我尝试为二级域名添加例外,如下所示:
<add input="{R:1}" pattern="second" negate="true"></add> 我也试过了:
<add input="{REQUEST_URI}" negate="true" pattern="[a-zA-Z0-9.\/?=_\-\&%:]*[s][e][c][o][n][d][a-zA-Z0-9.\/?=_\-\&%]*" ignoreCase="true"></add>
它们都不起作用。
花了一整天的时间,我想不出如何从http到https的重定向规则中排除二级域名。如果有任何帮助,我将不胜感激。
发布于 2016-05-14 06:04:26
将mymaindomain的文件夹更改为ftp根文件夹中的文件夹,并将同级更改为文件夹mysecondarydomain
发布于 2016-05-14 20:09:05
我已经用下面这行代码解决了这个问题:
<add input="{HTTP_HOST}" pattern="mysecondarydomain\.com" negate="true" ignoreCase="true"></add> https://stackoverflow.com/questions/37219938
复制相似问题