簡體   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