【问题标题】:301 redirects on Microsoft AzureMicrosoft Azure 上的 301 重定向
【发布时间】:2016-07-14 05:48:36
【问题描述】:

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

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

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

【问题讨论】:

  • URL 是否不同,或者只是方案不同:http 与 https?
  • app/cms 是用什么写的?另外,是否有描述旧 URL 到新 URL 的模式?
  • Asp.net - 没有模式只是新旧网址列表。

标签: azure redirect web seo http-status-code-301


【解决方案1】:

如果你只是将方案从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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-14
    • 1970-01-01
    • 1970-01-01
    • 2019-01-31
    • 2019-05-30
    • 1970-01-01
    • 1970-01-01
    • 2020-03-05
    相关资源
    最近更新 更多