Redirect 301 with Webconfig

1

I use a rule that works the most does not seem right to me. I think it ends up giving two 301 redirect.

            <!--Forçar https-->
            <rule name="Https" stopProcessing="true">
              <match url="^" ignoreCase="false" />
              <conditions>
                <add input="{HTTP_X_FORWARDED_PROTO}" pattern="https" ignoreCase="false" negate="true" />
                <add input="{HTTPS}" pattern="off" ignoreCase="false" />
              </conditions>
              <action type="Redirect" redirectType="Permanent" url="https://{HTTP_HOST}{URL}" />
            </rule>
            <!--Forçar Www-->
            <rule name="Www" stopProcessing="true">
                  <match url="^(.*)" ignoreCase="false" />
                  <conditions>
                    <add input="{HTTP_HOST}" pattern="^(site\.com\.br)(:80)?" />
                  </conditions>
                  <action type="Redirect" redirectType="Permanent" url="https://www.site.com.br/{R:1}" />
            </rule>

The first is to force https and the second force the www. As I put together a single rule that does both. It has to be in the same web.config.

    
asked by anonymous 17.06.2018 / 04:28

0 answers