https를 포함한 www 호출에 www가 호출되지 않도록 IIS를 구성하려고합니다. 처음 부분은 매우 쉽지만 해결책도 찾지 못했습니다. 바인딩에서 https를 사용하도록 설정할 때 작동합니다. IIS7.5는 www가 아닌 www로 www를 리디렉션합니다.
그래서 내가 좋아하는 것 모두 http://domain.com/ 및 모든 https://domain.com/ 및 http://www.domain.com/ 가 리디렉션 :어떤 제안?
https를 포함한 www 호출에 www가 호출되지 않도록 IIS를 구성하려고합니다. 처음 부분은 매우 쉽지만 해결책도 찾지 못했습니다. 바인딩에서 https를 사용하도록 설정할 때 작동합니다. IIS7.5는 www가 아닌 www로 www를 리디렉션합니다.
그래서 내가 좋아하는 것 모두 http://domain.com/ 및 모든 https://domain.com/ 및 http://www.domain.com/ 가 리디렉션 :어떤 제안?
This ended up working for me:
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
<rewrite>
<rules>
<rule name="Non www HTTP to HTTPS" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
<add input="{HTTP_HOST}" pattern="^www" negate="true" />
</conditions>
<action type="Redirect" url="https://www.{HTTP_HOST}{REQUEST_URI}" />
</rule>
<rule name="Non www HTTPS to www HTTPS" patternSyntax="ECMAScript" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="On" />
<add input="{HTTP_HOST}" pattern="^www" negate="true" />
</conditions>
<action type="Redirect" url="https://www.{HTTP_HOST}{REQUEST_URI}" />
</rule>
<rule name="HTTP to HTTPS" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" />
<add input="{HTTP_HOST}" pattern="www*" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" />
</rule>
</rules>
</rewrite>
@ 조쉬 : 답변은 첫 번째 요청에 사용됩니다. "https://www"으로 끝납니다. 하지만 "www."를 제거하면 주소에서 아래 이미지처럼 실패합니다.
나는 여전히 문제가 있습니다. 여기로 이동하는 경우 : https://www.skaljakke.dk/skaljakker-damer 모두 괜찮아 보이지만 "www." 그것은 실패 할 것이다. 어떤 제안이 있니? –
@ user3305839 www가 모두 포함 된 SSL 인증서가 있습니까? domain.com 만? 웹 서버는 먼저 핸드 셰이크를 수행 한 다음 리디렉션을 수행 할 수 있어야합니다. 두 가지를 모두 다루는 인증서가없는 경우 브라우저는 보안 예외를 감지합니다. – Josh