0

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?

CDenby
  • 95
  • 2
  • 6

1 Answers1

0

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:

enter image description here

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>
Victor Leontyev
  • 8,488
  • 2
  • 16
  • 36
  • Unless this is a separate rule, I can't see how it would work. I'm trying to push non-https requests to https. So my rule that is working is {HTTPS}=off redirect to https;//www.example.com and it works. I was putting in a separate condition in there with Match Any to capture https;//example.com. Are you suggesting a separate rule altogether? – CDenby Aug 25 '17 at 15:19
  • When I tried this in a separate rule, it didn't capture the case properly. – CDenby Aug 25 '17 at 15:21
  • So, do you want single rule, which will redirects `http://www.example.com`, `http://example.com`, `https://example.com` to `https://www.example.com`? – Victor Leontyev Aug 25 '17 at 15:46
  • Yes - exactly. However, if I need to do it with two separate rules, then that would work as well. – CDenby Aug 25 '17 at 16:13
  • Please check my answer – Victor Leontyev Aug 25 '17 at 16:36
  • It still seems to be failing. Can I send you the specifics to check out? – CDenby Aug 25 '17 at 17:07
  • you can find my email in my profile. You can send me details by email – Victor Leontyev Aug 25 '17 at 17:08