I have two domains hosted at GoDaddy:
www.mymaindomain.com
www.mysecondarydomain.com
The main domain is stored in a root ftp folder, the secondary domain is stored in a separate folder "second". I've purchased SSL certificate for my main domain, and applied http to https redirect in web.config, as described in GoDaddy help:
<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>
The problem is that the traffic to the secondary domain is also redirected to https and users receive security alerts. I've tried to add exceptions for the secondary domain as following:
<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>
Non of them worked.
After spending whole day, I've failed to figure out how to exclude the secondary domain from http to https redirect rule. I would appreciate any help.
将mymaindomain
的文件夹更改为ftp根文件夹中的文件夹,并将其兄弟文件夹mysecondarydomain
我用下面的代码行解决了这个问题:
<add input="{HTTP_HOST}" pattern="mysecondarydomain\.com" negate="true" ignoreCase="true"></add>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.