/amp/错误地显示在我所有 URL 的末尾。我已经修复了它,但现在我一团糟。我在搜索中有很多带有/amp/的网址,我需要重定向到末尾删除了/amp/的网址。我将如何使用 .htaccess 执行此操作?
我试过这个:
RewriteEngine On
RewriteRule ^(.*)/amp/?$ /$1/ [L,R=301]
而且它似乎不起作用。
如果您使用的是 Apache Web Server,则可以使用以下规则将所有 AMP 网址重定向到非 AMP 版本。
例 https://example.com/permalink/amp/
到https://example.com/permalink/
# Redirect from AMP to non-AMP path
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteRule ^ %1/ [R=301,L]
我希望这有所帮助。