This %{QUERY_STRING} ^(.*)/teste(.*)$
checks if you have /test
in QUERY_STRING
, something like http://localhost/foo/bar?foo=/test
, is that what you want? Now if the goal is to reach the URL this is wrong.
Another detail, probably the sign of ^
in front of ^/parcerias/teste.html
is wrong, this signal is for regex, and there is no regex is the destination path only, so remove it, it should look like this: / p>
RewriteRule ^(.*)$ /parcerias/teste.html
I think it's either REQUEST_URI
to check the PATH (path in URL):
RewriteEngine On
RewriteCond %{REQUEST_URI} ^(.*)/teste(.*)$
RewriteRule ^(.*)$ /parcerias/teste.html?utm_source=teste&utm_medium=site&utm_campaign=parcerias [R=302,L]
Or simply apply to RewriteRule
:
RewriteEngine On
RewriteRule ^(.*)/teste(.*)$ ^/parcerias/teste.html?utm_source=teste&utm_medium=site&utm_campaign=parcerias [R=302,L]
Of course this will probably cause a loop, since the redirected URL also has /teste
in /parcerias/teste.html
, you probably want to otherwise prevent redirection if it already is in a URL with /teste
, so what you want is a condition of not containing /teste
, in this case just use the sign of !
, like this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^(.*)/teste(.*)$
RewriteRule ^(.*)$ /parcerias/teste.html?utm_source=teste&utm_medium=site&utm_campaign=parcerias [R=302,L]