2017-07-25 114 views
0

我試圖設置一個重定向,它將檢測是否使用https並將流量重定向到https://example.com.au,並且如果使用http重定向流量到http://123.com.au針對HTTPS和HTTP的IIS重定向

我目前正在使用IIS重寫。

我試過做一些事情,但它不工作。

+0

請閱讀(//元.stackoverflow.com/q/326569) - 總結是,這不是解決志願者問題的理想方式,而且可能會對獲得答案產生反作用。請不要將這添加到您的問題。 – halfer

回答

0

你可以做到這一點與這些規則:?在什麼情況下我想補充「緊急」或其他類似的短語我的問題,爲了獲得更快的答案]

<rule name="Redirect with HTTPS" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions><add input="{HTTPS}" pattern="^ON$" /> 
    </conditions> 
    <action type="Redirect" url="https://example.com.au/{R:1}" /> 
</rule> 
<rule name="Redirect without HTTPS" stopProcessing="true"> 
    <match url="(.*)" /> 
    <conditions><add input="{HTTPS}" pattern="^OFF$" /> 
    </conditions> 
    <action type="Redirect" url="http://123.com.au/{R:1}" /> 
</rule>