[英]Rewrite rule not working for redirection from http to https
Tried below code but it's not working, entered rewrite tag in system.webServer tag in web.config file of c# , Shows error rewrite can not be child element of system.webServer tag, I have also configured this rule in IIS 尝试下面的代码,但是它不起作用,在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>
Install Urlrewrite module if its not installed using web platform installer and try to manually add rule using urlrewrite module. 如果未使用Web平台安装程序安装Urlrewrite模块,请安装该模块,然后尝试使用urlrewrite模块手动添加规则。
https://www.iis.net/downloads/microsoft/web-platform-installer https://www.iis.net/downloads/microsoft/web-platform-installer
https://www.iis.net/downloads/microsoft/url-rewrite https://www.iis.net/downloads/microsoft/url-rewrite
Regards, Jalpa. 问候,贾尔帕。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.