简体   繁体   中英

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

(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.

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:

在此处输入图片说明

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>

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.

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