Answer the question
In order to leave comments, you need to log in
Website redirect after switching from Yandex Zen?
The problem is that users access from the Yandex Zen feed at a URL like
https://site.ru/karty/sovet-tem-kto.html?utm_refer...
https://site.ru/karty/sovet-tem-kto.html ?utm_refer...
https://site.ru/znat/skolko-mogut-snimat.html?utm_...
It is
necessary to redirect from these URLs to the normal short address of the pages:
https://site.ru/karty/sovet -tem-kto.html
Answer the question
In order to leave comments, you need to log in
Found the answer:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{QUERY_STRING} utm_referrer=(.*)
RewriteRule ^(.*)$ /$1? [R=301,L]
</IfModule>
1. www.adventum.ru/blog/rel-canonical-how-to to help you and don’t invent a wheel
2. Prohibit indexing get parameters in robots, especially since they start with utm
3. sitemap.xml
4. GET parameter is not part of url and is allocated as a separate request in the rewrite cond, so you can make a condition for all
utm
RewriteCond %{QUERY_STRING} (^|&)utm_referrer\=https\://zen\.yandex\.com($|&)
RewriteRule ^karty/sovet\-tem\-kto\.html$ /? [L,R=301]
RewriteCond %{QUERY_STRING} (^|&)utm_referrer\=.+($|&)
RewriteRule ^(.+)$ /$1/? [L,R=301]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question