A
A
adreanov2017-09-01 19:44:55
htaccess
adreanov, 2017-09-01 19:44:55

How to make a redirect if there is a utm tag?

How to redirect using htaccess to redirect to a specific page?
For example, for those who came from an advertisement (with the tag ?utm_source) show one page, and for those who came without a tag, show another page. And all this is invisible to the user.
Here is an example:

RewriteCond %{HTTP_HOST} ^site\.ru
RewriteCond %{QUERY_STRING} utm_source=adwords
RewriteRule ^(.*)$ http://google.site.ru/$1 [R=301,L

- but here on a different domain, but how to make a page inside the site?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Maxim Fedorov, 2017-09-01
@Maksclub

RewriteRule ^promo	index.php?utm_source=adwords [L,QSA]

V
Viktor Taran, 2017-09-01
@shambler81

redirect if url contains yutm source adwords

RewriteCond %{HTTP_HOST} ^www\.test\.com$
RewriteCond %{QUERY_STRING} (^|&)^utm_source\=adwords($|&)
RewriteRule ^(.*)$ http://google.site.ru/$1 [R=301,L]

If it does not exist on the contrary
RewriteCond !%{QUERY_STRING} (^|&)^utm_source\=adwords($|&)
RewriteRule ^(.*)$ http://google.site.ru/$1 [R=301,L]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question