簡體   English   中英

Web配置HTTP到https重定向異常

[英]web config http to https redirect exception

我在GoDaddy托管了兩個域:

www.mymaindomain.com

www.mysecondarydomain.com

主域存儲在根ftp文件夾中,輔助域存儲在單獨的文件夾“ second”中。 我已經為我的主域購買了SSL證書,並按照GoDaddy幫助中的說明將http應用於web.config中的https重定向:

 <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重定向規則。 我將不勝感激任何幫助。

mymaindomain的文件夾更改為ftp根文件夾中的文件夾,並將其兄弟文件夾mysecondarydomain

我用下面的代碼行解決了這個問題:

<add input="{HTTP_HOST}" pattern="mysecondarydomain\.com" negate="true" ignoreCase="true"></add> 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM