在多个域之间重定向到HTTPS

时间:2016-11-04 08:20:59

标签: https url-rewriting iis-7.5

我有两个域名(例如domainone.com和domaintwo.com),他们指向一个网站。 我为domainone.com提供了一个ssl证书。

我想为domainone.com自动重定向到https。 我不想为domaintwo.com自动重定向到https因为我没有这个domaintwo.com的ssl证书。我只想用http打开它。

url rewrite(IIS)中的规则如下所示。

Match URL – Requested URL: Matches the Pattern
Match URL – Using: Regular Expression
Pattern: (.*)

Condition Input: {HTTPS}
Check if input string: Matches the Pattern
Pattern: ^OFF$

Action type: Redirect
Redirect URL: https://{HTTP_HOST}/{R:1}
Redirect type: See Other (303)

现在两个域名都自动重定向到https。请帮助我如何只为domainone.com自动重定向到https。

谢谢。

1 个答案:

答案 0 :(得分:0)

我添加了一个条件。现在它正在按我的意愿工作。

Match URL – Requested URL: Matches the Pattern
Match URL – Using: Regular Expression
Pattern: (.*)

Condition Input: {HTTPS}
Check if input string: Matches the Pattern
Pattern: ^OFF$
Condition Input: {HTTP_HOST}
Check if input string: Matches the Pattern
Pattern: domainone.com

Action type: Redirect
Redirect URL: https://{HTTP_HOST}/{R:1}
Redirect type: See Other (303)
相关问题