F
F
full-size2021-04-22 05:24:02
htaccess
full-size, 2021-04-22 05:24:02

How to remove duplicate pages through 301 redirect?

Hello!
Please tell me a ready-made solution for 301 redirects. There are several pages:

https://site.ru/kak-posmotret-tv/?utm_referrer=https:%2F%2Fyandex.ru%2Fsearchapp%3Ffrom%3Dalice%26text%3D

https://site.ru/kto-izobrel-radio/?utm_referrer=https:%2F%2Fyandex.ru%2Fsearchapp%3Ffrom%3Dalice%26text%3D

https://site.ru/eto-bilo-vecherom/?utm_referrer=https:%2F%2Fyandex.ru%2Fsearchapp%3Ffrom%3Dalice%26text%3D


Help create a universal construct for all addresses in the .htaccess file, which will redirect through 301 redirects all these pages, cutting off the tails, so that we end up with addresses:

https://site.ru/kak-posmotret-tv/

https://site.ru/kto-izobrel-radio/

https://site.ru/eto-bilo-vecherom/


Thank you in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor Taran, 2021-04-22
@full-size

so the redirect itself

RewriteCond %{QUERY_STRING} (?:^|&)utm_referrer\=https\:%2F%2Fyandex\.ru%2Fsearchapp%3Ffrom%3Dalice%26text%3D(?:$|&)
RewriteRule ^kak\-posmotret\-tv/$ /kak\-posmotret\-tv/? [L,R=301]

And so for any urls with such GETE
RewriteCond %{QUERY_STRING} (?:^|&)utm_referrer\=https\:%2F%2Fyandex\.ru%2Fsearchapp%3Ffrom%3Dalice%26text%3D(?:$|&)
RewriteRule ^(.+)/$ /$1/? [L,R=301]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question