301 Redirect with characters at the end of the link

64 Views Asked by At

I disable my AMP plugin and i have two type AMP Pages and want to want to redirect them to orginal pages these pages with 301 redirect:

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

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

to

https://example.com/post-name

I try this but it just redirect /amp and not redirect ?amp=1

RewriteEngine On

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

RewriteRule ^ %1/ [R=301,L]

1

There are 1 best solutions below

0
On

i find it

RewriteCond %{THE_REQUEST} /?amp=1

RewriteRule ^(.+)$ /$1? [L,R]