2015-02-23 70 views
0

我想任何重定向到https://domain.com
我發現這個代碼:重定向的https:// WWW到https://通過web.config中

<rewrite> 
    <rules> 
     <rule name="SecureRedirect" stopProcessing="true"> 
     <match url="^(.*)$" /> 
     <conditions> 
      <add input="{HTTPS}" pattern="off" /> 
      <add input="{HTTP_HOST}" pattern="^(www\.)?(.*)$" /> 
     </conditions> 
     <action type="Redirect" url="https://{C:2}" redirectType="Permanent" /> 
     </rule> 
    </rules> 
    </rewrite> 

及其工作除了在https://www.domain.com
我的虛擬服務器是Windows Server 2012與IIS 8,並且域是https://kajsystem.com

回答

0

我會建議使用IIS 8配置,包括使用URL重寫模塊,它可以處理轉發並保留整個請求的URL。在MSDN網站上有一篇相當全面的文章覆蓋了這個:

MSDN redirect on IIS 7 and higher

相關問題