IIS 中的 http 到 https
http to https in 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,而不更改用户输入的其余 url。
这是我们在我们的一个网站上使用的自动重定向所有流量到 https 版本的方法。它还包括 url.
中的所有其他内容
<rewrite>
<rules>
<clear />
<rule name="Redirect to https" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="true" />
</rule>
</rules>
</rewrite>
我知道这是一个简单的问题,但我就是找不到答案。我应用了以下规则...
<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,而不更改用户输入的其余 url。
这是我们在我们的一个网站上使用的自动重定向所有流量到 https 版本的方法。它还包括 url.
中的所有其他内容<rewrite>
<rules>
<clear />
<rule name="Redirect to https" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="true" />
</rule>
</rules>
</rewrite>