繁体   English   中英

Web.config 重写规则 http 到 https 和 ZD18B8624A0F5F721DA7B8236 路由组合

[英]Web.config rewrite rule http to https and angular route combination

对于 angular 应用程序,我在 IIS 有以下重写规则:

<rewrite>
    <rules>
        <rule name="Angular Routes1" enabled="true" stopProcessing="true">
            <match url=".*" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.html" />
        </rule>
        <rule name="HTTPS Redirect" stopProcessing="true">
            <match url="(.*)" />
            <conditions>
                <add input="{HTTPS}" pattern="^OFF$" />
            </conditions>
            <action type="Redirect" url="https://www.example.com{REQUEST_URI}" appendQueryString="false" />
        </rule>
    </rules>
</rewrite>

When someone browses http://www.example.com , its being redirected to https://www.example.com , but when I use a route that setup the website, for example:

http://www.example.com/layout/dark它没有重定向到https://www.example.com/layout/dark

我想知道我在添加两条规则时是否犯了错误,应该全部添加到一条规则中。

谢谢。

可以先把 http 到 https 规则再试。 如果仍然不起作用,您可以使用失败的请求跟踪来查看详细的错误原因。

使用失败的请求跟踪来跟踪重写规则

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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