[英]Rewrite rule not working for redirection from http to https
嘗試下面的代碼,但是它不起作用,在c#的web.config文件的system.webServer標記中輸入了rewrite標記,顯示錯誤的重寫不能是system.webServer標記的子元素,我也在IIS中配置了此規則
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule1" enabled="true" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
如果未使用Web平台安裝程序安裝Urlrewrite模塊,請安裝該模塊,然后嘗試使用urlrewrite模塊手動添加規則。
https://www.iis.net/downloads/microsoft/web-platform-installer
https://www.iis.net/downloads/microsoft/url-rewrite
問候,賈爾帕。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.