There is a site, links with utm tags lead to it (simple GET parameters in a line). The question is - how can I make a redirect, based on the conditions on the GET parameter?

I understand that the algorithm is something like this:

//получаем строку запроса //выбираем необходимые данные (т.е. utm_* GET параметры) //делаем условный оператор if() в .htaccess 

But how to do it right? For the first time I come across this in .htaccess.

Ps version Apache 2.4, <if> supports

    1 answer 1

    Documentation for the if directive can be found here .

    A simple example of checking for the presence, for example, the GET of the parameter utm_one , using a regular expression ( \b - word boundary, [^&=]+ - checking for the presence of content in the parameter):

     <If "%{QUERY_STRING} =~ /\butm_one=[^&=]+/"> # действия выполняются при наличии utm_one </If> <Else> # действия выполняются при отсутствии utm_one </Else>