O
O
oe24y2017-01-25 14:29:49
htaccess
oe24y, 2017-01-25 14:29:49

How to make a redirect to the main page of the site in .htaccess if there are utm_source GET parameters?

Have a domain mysite.com
Want all URL requests like
mysite.com? utm_source =mymetka
redirected to
mysite.com
Thank you all in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Pavel, 2017-01-25
@oe24y

Why exactly? Search engines don't count them.
And so the option:

RewriteCond %{QUERY_STRING} ^utm_source= [NC]
RewriteRule (.*) $1? [R=301,L]

Another option:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^((.*?)&|)utm_
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1?%2 [R=301,NE,L]

Or in robots
Disallow: /*utm_*=

E
Eugene, 2017-01-25
@Nc_Soft

read about QSA flags

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question