2012-05-25 2 views
4

현재 프로덕션 서버에서 인바운드 규칙을 다음과 같이 설정하여 모든 내 요구 사항에 대해 작동합니다.IIS에서 인바운드 규칙 추가 [UrlRewite]

인바운드 규칙은 다음과 같습니다.

Match URL section 
Requested URL: Matches the Pattern 
Using: Regular Expression 
Pattern: (.*) 
Ignore Case: checked. 

Conditions section 
Logical grouping: Match All. 
Input: {HTTPS} 
Type: Matches the Pattern 
Pattern: ^OFF$ 
Track capture groups across conditions: unchecked. 

Action section: 
Action type: Redirect 
Redirect URL: https://www.domainname.com/{R:0} 
Append query string: checked. 
Redirect Type: Permanent (301). 

내 요구 사항은 다음과 같습니다 때 사용자 유형

https://beta.domain.com it should redirect to https://www.domain.com. 

경우 사용자 유형

http://beta.domain.com it should redirect to https://www.domain.com. 

하면 사용자 유형

http://www.domain.com it should redirect to https://www.domain.com 

사용자 유형

만약
http://domain.com it should redirect to https://www.domain.com 

미리 감사드립니다. 도움이 될 것입니다.

미리 감사드립니다.

답변

3

정확히 조건부가하는 일이 아닙니까? HTTPS가 꺼져 있는지 확인한 다음 리디렉션 만 발생합니다. HTTPS가 켜져 있으면 리다이렉트하지 않는다고 가정하면 끝이없는 리디렉션으로 끝납니다.

항상 호스트 이름이 www.domainname.com 인 경우 추가 조건으로 추가해야합니다. 하나 HTTPS경우 예 :은 :

<rule name="Force HTTPS and host name: www.domainname.com" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions logicalGrouping="MatchAny"> 
     <add input="{HTTPS}" negate="true" pattern="^ON$" /> 
     <add input="{HTTP_HOST}" negate="true" pattern="^www\.domainname\.com$" /> 
    </conditions> 
    <action type="Redirect" url="https://www.domainname.com/{R:0}" appendQueryString="true" redirectType="Permanent" /> 
</rule> 

하지ON 또는 HTTP_HOST는 리디렉션 하지www.domainname.com입니다. 둘 다 사실 인 경우에만 리디렉션되지 않습니다.

+0

감사합니다. Marco, 귀하의 도움을 추가했습니다 !!!. 그러나 그것은 나의 요구를 만족시키지 못하고 있었다. 내 질문에 한 번 내 요구 사항을 확인하십시오. 요구 사항 섹션을 더 명확하게 업데이트했습니다. 미리 감사드립니다. – shakti

+0

나는 그것이 당신의 첫 번째 요구 사항을 제외하고는 귀하의 모든 요구 사항을 충족 시키지만 그것은 HTTPS의 성격 때문이라고 생각합니다. 첫 번째 요구 사항은 SSL 인증서가'* .domainname.com'의 와일드 카드 인증서이거나 'www.domainname.com'과 'beta.domainname.com'의 다중 도메인 인증서 인 경우에만 사용할 수 있습니다. 인증서가'www.domainname.com '에 대해서만 유효하다면'https : // beta.domainname.com'을 열 때 브라우저가 보안 경고를 표시하게됩니다. 당신이나 IIS가 할 수있는 일은 아무것도 없습니다. –