如何将 /amp 网址重定向到非 AMP 版本?



首先,我想告诉你们,我已经在以下线程中搜索了解决方案,但它们不起作用。

.htaccess 重定向/amp/网址到非安培版本

如何将放大器内容重定向到正常模式

从 AMP 网址重定向到真实网址

我在我的 .htaccess 中添加了规则:重写规则 ^(.*(/amp$ $1 [R=301,L],如下所示:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteRule ^(.*)/amp$ $1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

但它仍然没有将我的 amp 链接带到他们的非 AMP 原始链接。请帮我解决这个问题。

您可以在 .htaccess 文件上尝试此规则:

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

测试您的网址

最新更新