0
votes

I have a site setup to use SSL certs and serve the site via https. However, I cannot get URL Rewrite to work properly to redirect attempted connection attempts to follow certain rules that will, in the end, result to a specific url being used.

For security reasons at this time, I will just say the domain is: example.com

What I am trying to do is the following.

For example, lets say I have these before/afters:

And so on. However, no matter what example I use I can find online to perform HTTP to HTTPS redirects, I am left with IIS just causing infinite loops redirecting and never properly working.

Bindings on the site in IIS are as follows:

  • Type: http / Host Name: www.example.com / Port: 80 / IP Address: *
  • Type: http / Host Name: example.com / Port: 80 / IP Address: *
  • Type: https / Host Name: www.example.com / Port: 443 / IP Address: *
1
Can you please add a list of your rules from web.config.Victor Leontyev

1 Answers

1
votes

I use this one

<rewrite>
  <rules>
    <rule name="Redirect to HTTPS" stopProcessing="true">
      <match url="(.*)" />
      <conditions>
        <add input="{HTTPS}" pattern="^OFF$" />
      </conditions>
      <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Found" />
    </rule>
  </rules>
</rewrite>