繁体   English   中英

重写规则不适用于从http重定向到https

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM