【问题标题】:How to make a 301 redirect rule for old AMP pages?如何为旧 AMP 页面制定 301 重定向规则?
【发布时间】:2020-09-26 08:42:31
【问题描述】:

我的网站使用的是旧 AMP 插件,该插件在每个帖子/页面网址后添加 /amp/。
所以我的家是:https://jeretiens.net,而放大器是https://jeretiens.net/amp/

我想知道我可以在 .htaccess 上设置什么规则,以将所有这些 /amp/ 重定向到“正常”页面本身。
例如:https://example./my-article-1/amp/ 重定向到 https://example./my-article-1/https://example.com/my-article-2/ 重定向到 https://example./my-article-2/,它适用于每篇文章/页面。

我确信不用在 .htaccess 中输入 1000 行的 301“简单”重定向就可以做到这一点!

【问题讨论】:

    标签: .htaccess redirect amp-html


    【解决方案1】:

    好吧,伙计们,

    我找到了解决方案,这是您需要用来告别 /amp/ 的重定向规则:

    RewriteEngine On 
    RewriteCond %{REQUEST_URI} (.+)/amp(.*)$ 
    RewriteRule ^ %1/ [R=301,L]
    

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 2017-01-12
      • 1970-01-01
      • 1970-01-01
      • 2013-10-03
      • 2010-12-22
      • 2011-01-05
      • 1970-01-01
      相关资源
      最近更新 更多