如何为旧 AMP 页面制定 301 重定向规则?
How to make a 301 redirect rule for old AMP pages?
我的网站是在一个旧的 AMP 插件上,它在每个 post/page url.
之后添加 /amp/
例如我的家是:https://jeretiens.net and the amp one was https://jeretiens.net/amp/
我想知道我可以在 .htaccess 上设置什么规则来将所有这些 /amp/ 重定向到 "normal" 页面本身。
因此,例如:https://example./my-article-1/amp/ redirects to https://example./my-article-1/, https://example.com/my-article-2/ redirects to https://example./my-article-2/ 它对每个 article/page.
我确信无需在 .htaccess 中键入 1000 行 301 "easy" 重定向就可以做到这一点!
好的伙计们,
我找到了解决方案,这是您需要告别 /amp/:
的重定向规则
RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteRule ^ %1/ [R=301,L]
希望对您有所帮助
我的网站是在一个旧的 AMP 插件上,它在每个 post/page url.
之后添加 /amp/
例如我的家是:https://jeretiens.net and the amp one was https://jeretiens.net/amp/
我想知道我可以在 .htaccess 上设置什么规则来将所有这些 /amp/ 重定向到 "normal" 页面本身。
因此,例如:https://example./my-article-1/amp/ redirects to https://example./my-article-1/, https://example.com/my-article-2/ redirects to https://example./my-article-2/ 它对每个 article/page.
我确信无需在 .htaccess 中键入 1000 行 301 "easy" 重定向就可以做到这一点!
好的伙计们,
我找到了解决方案,这是您需要告别 /amp/:
的重定向规则RewriteEngine On
RewriteCond %{REQUEST_URI} (.+)/amp(.*)$
RewriteRule ^ %1/ [R=301,L]
希望对您有所帮助