将无抵押的域重定向到将HTTP固定到HTTPS

发布于 2025-02-13 09:17:52 字数 575 浏览 0 评论 0原文

我使用此(web.config)将我的所有域从http重定向到https:

<rule name="ssl redirect" enabled="true" stopProcessing="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTPS}" pattern="^OFF$" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
            </rule>

但是,这对一个末端的域不起作用:

mydomain7.com

有什么建议吗? 谢谢

I used this (web.config) to redirect all my domain from http to https:

<rule name="ssl redirect" enabled="true" stopProcessing="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTPS}" pattern="^OFF
quot; />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
            </rule>

However this wont work for a domain with number at the end:

mydomain7.com

any suggestion?
Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

回忆追雨的时光 2025-02-20 09:17:52

我通过添加重定向类型解决了问题,还添加了其他输入:

<rule name="ssl redirect" enabled="true"   stopProcessing="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http$" />
                    <add input="{HTTPS}" pattern="^OFF$" />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
            </rule>

I solved the issue by adding redirect type and also add additional input:

<rule name="ssl redirect" enabled="true"   stopProcessing="true">
                <match url="(.*)" />
                <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    <add input="{HTTP_X_FORWARDED_PROTO}" pattern="^http
quot; />
                    <add input="{HTTPS}" pattern="^OFF
quot; />
                </conditions>
                <action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Found" />
            </rule>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文