301 在链接末尾使用字符重定向

301 Redirect with characters at the end of the link

提问人:Pouya Zehfroush 提问时间:7/23/2023 更新时间:7/23/2023 访问量:28

问:

我禁用了我的 AMP 插件,并且我有两个类型的 AMP 页面,并希望将它们重定向到这些带有 301 重定向的原始页面:

https://example.com/post-name/?amp=1

https://example.com/post-name/amp

https://example.com/post-name

我尝试这个,但它只是重定向 /amp 而不是重定向 ?amp=1

RewriteEngine 开启

重写 %{REQUEST_URI} (.+)/amp(.*)$

重写规则 ^ %1/ [R=301,L]

http-status-code-301 post-redirect-get asynchronous-messaging-protocol

评论


答:

0赞 Pouya Zehfroush 7/23/2023 #1

我找到了

重写 Cond %{THE_REQUEST} /?amp=1

重写规则 ^(.+)$ /$1?[左,右]