我意識到這是一個簡單的問題,但我只是找不到答案。我已經應用了以下規則...http to https在IIS中
<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>
的URL我感興趣的是有圖案
http://[domain]/[directory]/[aspx page]
所以http://example.com/funstuff/thefair.aspx
重寫的結果http://[domain]/[an_aspx_page]
所以重寫是刪除目錄。我認爲{R:1}指定了一個將被重寫的參數,並且我嘗試了https:// {HTTP_HOST}/{R:1}/{R:2},但是這會導致500錯誤。
我希望將此域中的所有流量指向https而不更改用戶輸入的其餘網址。
{R:1}和{R:2}(等)表示用於匹配URL的正則表達式的捕獲組。您沒有第二個捕獲組,這就是爲什麼{R:2}未定義的原因。 http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module –