K
K
Kirill Glushakov2016-04-05 12:13:45
htaccess
Kirill Glushakov, 2016-04-05 12:13:45

How to make Redirect with UTM tag via .htaccess file?

Good day. Help solve the problem with Redirect.
Have an Instagram account. There is a link to the site from there. As you know, Yandex.Metrica does not take into account conversions from Instagram.
To do this, it took place to make UTM tags for correct display in Yandex.Metrica. Well, in order for the Instagram profile to have a beautiful URL for the transition, such a short link was invented
: http://site_address.ru/instagram
When you click on this link, theoretically it should redirect to a page with a UTM tag
http://site_address.ru/? utm_source=instagram&utm_medium=social&utm_campaign=smm
Accordingly added the following code to the .htaccess
file: # Instagram Redirect UTM
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/instagram$
RewriteRule ^.*$ http://site_address.ru/?utm_source=instagram&utm_medium=social&utm_campaign=smm [R=301,L]


Options -Indexes
ErrorDocument 404 /404.php
RewriteCond %{HTTP_HOST} ^www.website\.ru$ [NC]
RewriteRule ^(.*)$ ttp://website.ru/$1 [R=301,L]
RewriteEngine On RewriteCond % {
HTTP_HOST} ^www.old_site_url\.ru$ [NC] RewriteRule ^
(.*)$ (.*) http://site_address.ru/$1 [R=301,L] php_flag allow_call_time_pass_reference 1 php_flag session.use_trans_sid off php_value display_errors 1 #php_value mbstring.internal_encoding UTF-8 Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} ! -f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !/opencart/urlrewrite.php$
RewriteRule ^(.*)$ /opencart/urlrewrite.php [L]
RewriteRule .* - [ E=REMOTE_USER:%{HTTP:Authorization}]
DirectoryIndex index.php index.html
ExpiresActive on
ExpiresByType image/jpeg "access plus 3 day"
ExpiresByType image/gif "access plus 3 day"
# Instagram Redirect UTM
RewriteEngine On
RewriteCond %{REQUEST_URI } ^/instagram$
RewriteRule ^.*$

Question: What did I do wrong..? Where did you go wrong..?
Help solve the problem...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Viktor Taran, 2016-04-05
@shambler81

answering the question, you made the wrong question.
https://donatstudios.com/RewriteRule_Generator

K
Kirill Glushakov, 2016-04-05
@thvanx

And how to do it right..?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question