2015-01-04 2 views
1

모든 .net 트래픽이 내 .com으로 이동하므로이 규칙을 만들었으므로이 규칙을 작성하지 않았으므로이 규칙을 잘못 작성했다고 확신합니다.하늘색 웹 사이트가 web.config의 규칙을 web.config로 리디렉션하도록 수정했습니다.

<rule name=".net to .com" enabled="true" stopProcessing="true"> 
     <match url=".*mywebsite.net.*"/> 
     <action type="Redirect" url="https://mywebsite.com/" appendQueryString="false" redirectType="Permanent" /> 
     </rule> 

은 내가이 정규식이 제대로 작성했다 가정하지만, 정규식은 정규식에 문제가 내 장점

답변

1

아니다 그러나 이것은 일반적으로 어떤 무엇을 어떻게 (도메인 이름 규칙 정식되지 않습니다 : 작업 이 경우 원하는)가 설정됩니다. 일반적으로 과 일치하는 모든 URL을 서버에 입력 한 다음 CGI 환경 변수 값 (이 경우 HTTP_HOST)을 필터링합니다. 귀하의 재 작성 규칙은 다음과 같이 보일 것입니다 :

<rule name="CanonicalHostNameRule1" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions> 
     <add input="{HTTP_HOST}" pattern="^mywebsite\.com$" negate="true" /> 
    </conditions> 
    <action type="Redirect" url="https://mywebsite.com/{R:1}" appendQueryString="false" redirectType="Permanent" /> 
</rule> 

이것이 할 것입니다 것은 앞으로 https://mywebsite.com-http://mywebsite.com 또는 https://mywebsite.com을하지 않은 URL의 모든 요청이다. 실제 URL은 일치 항목에 캡처되고 {R:1} 매개 변수에 넣습니다. 이렇게하면 http://www.mywebsite.net/home.php이라고 말하면 https://mywebsite.com/home.php으로 리디렉션됩니다. 당신이 HTTPS를 시행 할 경우

또한, 다음을 수행 할 수 있습니다

<rule name="CanonicalHostNameRule1" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions logicalGrouping="MatchAny"> 
     <add input="{HTTPS}" pattern="^on$" negate="true" /> 
     <add input="{HTTP_HOST}" pattern="^mywebsite\.com$" negate="true" /> 
    </conditions> 
    <action type="Redirect" url="https://mywebsite.com/{R:1}" appendQueryString="false" redirectType="Permanent" /> 
</rule> 

첫 번째 조건은 cgi.HTTPS이 ... "의"있는지 확인하고 그렇지 않은 경우,로 리디렉션됩니다 HTTPS URL.

참고 : 만 mywebsite.net URL을 재 지정하려면는 다음 조건이 다음과 같습니다이 도움이

<add input="{HTTP_HOST}" pattern="mywebsite\.net$" /> 

희망.

관련 문제