简体   繁体   English

IIS 8 URL重写https和www

[英]iis 8 url rewrite https and www

I need to make the following redirects and I can't get the last one: 我需要进行以下重定向,但无法获取最后一个重定向:

all have to go to: 所有必须去:

  • https;//www.example.com https; // www.example.com

(Note: the semicolons are actually colons) (注意:分号实际上是冒号)

The first two are taken care of with a condition "{HTTPS} Matches off" but I'm trying to get the last one working with either {HTTP_HOST} or {URL} and nothing is happening. 前两个条件是“ {HTTPS} Matches off”,但我正在尝试使最后一个条件与{HTTP_HOST}或{URL}一起使用,但没有任何反应。

What condition will work for me? 什么条件对我有用?

You need to create two conditions: 您需要创建两个条件:

<conditions>
    <add input="{HTTPS}" pattern="on" />
    <add input="{HTTP_HOST}" pattern="^example.com$" />
</conditions>

In IIS Manager it looks like that: 在IIS管理器中,它看起来像这样:

在此处输入图片说明

UPDATE 更新

Based on our discussion in comments: 根据我们在评论中的讨论:

<rule name="All in one URL" stopProcessing="true">
    <match url=".*" />
    <conditions logicalGrouping="MatchAny">
        <add input="{HTTPS}" pattern="off" />
        <add input="{HTTP_HOST}" pattern="^www\." negate="true" />
     </conditions>
     <action type="Redirect" url="https://www.example.com:35077{URL}" />
 </rule>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM