Web.config 重写规则在 Google Chrome 中不起作用
Web.config rewrite rule not working in Google Chrome
当我在 chrome 以外的任何浏览器中访问 mycompany.com 时,它成功重定向到 https://www.mycompany.com。然而,在 Chrome 中,我只得到一个 404,同上所有 chrome 用户。
在 web.config 我有这个重定向规则
<rewrite>
<rules configSource="">
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="true" />
</rule>
</rules>
</rewrite>
我认为这是它在其他浏览器中工作的原因。
我试过添加 HTTP 重定向 dns 记录,但这似乎没有帮助。
我真的没有解释。我自己也在用。
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
它们看起来非常相似,但我没有发现重定向到 https 的问题。也许是其他原因导致了 404?
打开一个隐身标签并确认它正在重定向到您想要的 URL。
关闭隐身标签
清除GoogleChrome缓存
然后它应该会重定向您而无需使用隐身模式
当我在 chrome 以外的任何浏览器中访问 mycompany.com 时,它成功重定向到 https://www.mycompany.com。然而,在 Chrome 中,我只得到一个 404,同上所有 chrome 用户。
在 web.config 我有这个重定向规则
<rewrite>
<rules configSource="">
<clear />
<rule name="Redirect to https" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" redirectType="Permanent" appendQueryString="true" />
</rule>
</rules>
</rewrite>
我认为这是它在其他浏览器中工作的原因。
我试过添加 HTTP 重定向 dns 记录,但这似乎没有帮助。
我真的没有解释。我自己也在用。
<rewrite>
<rules>
<rule name="HTTP to HTTPS redirect" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="off" ignoreCase="true" />
</conditions>
<action type="Redirect" redirectType="Found" url="https://{HTTP_HOST}/{R:1}" />
</rule>
</rules>
</rewrite>
它们看起来非常相似,但我没有发现重定向到 https 的问题。也许是其他原因导致了 404?
打开一个隐身标签并确认它正在重定向到您想要的 URL。
关闭隐身标签
清除GoogleChrome缓存
然后它应该会重定向您而无需使用隐身模式