gpt4 book ai didi

azure - Microsoft Azure 上的 301 重定向

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:40:03 24 4
gpt4 key购买 nike

我有一个在 Microsoft Azure 上运行的网站。我正在为这个网站开发一个新的 CMS 系统,并且将使用 https 而不是新网站的 http。所以我必须将所有旧网址重定向到新网址。旧网址和新网址不同 - 不仅仅是 http 与 https 不同。

对我所有的旧页面进行 301 重定向的正确方法是什么?它必须正确完成,所以它不会影响 SEO。

对于 Apache 网络服务器,您只需创建一个包含新旧 url 的 .htaccess 文件,该文件将用作 301 重定向文件。看到这个: https://mediatemple.net/community/products/grid/204643080/how-do-i-redirect-my-site-using-a-htaccess-fileAzure 和 asp.net 一定有类似的东西。

最佳答案

如果您只是将方案从 http 重写为 https,那么您可以在 <system.webServer> 中使用以下规则:

<rewrite>
<rules>
<rule name="Force HTTPS" enabled="true">
<match url="(.*)" ignoreCase="true" />
<conditions>
<add input="{HTTPS}" pattern="off" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>

关于azure - Microsoft Azure 上的 301 重定向,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36237433/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com