Mobile app version of vmapp.org
Login or Join
Courtney195

: 301 redirection removes UTM tags from URLs A page redirects to another page using a 301 redirect in a .htaccess file. If I try to access the page from a URL with UTM tagging, after redirection,

@Courtney195

Posted in: #301Redirect #GoogleAnalytics #Htaccess #UrlRewriting

A page redirects to another page using a 301 redirect in a .htaccess file.
If I try to access the page from a URL with UTM tagging, after redirection, it removes all UTM tagging.

Is this normal behavior? How can we keep the UTM tagging so that we can see this in our analytics?

Here are some examples:

Example 1:
example.com/page.html?utm_source=nosource&utm_medium=nomedium&utm_campaign=nocam
redirects to:
example.com/another-page.html
Example 2:
example.com/page.html?utm_source=nosource&utm_medium=nomedium&utm_campgn=nocam&page=1 (Just misspelled utm_camaign to check if utm_ is not just a culprit)

redirects to:
example.com/another-page.html?utm_campgn=nocam&page=1
Example 3:
example.com/page.html?utm_source=nosource&utm_medium=nomedium&utm_campaign=nocam&page=1
redirects to:
example.com/another-page.html?page=1
Example 4:
example.com/page.html?page=1
redirects to:
example.com/another-page.html?page=1


Excerpt from .htaccess:

RewriteRule ^home-living/furniture/([^/.]+).html www.example.com/home-living/furniture/filter/cat/.h‌​tml [R=301,L]

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Courtney195

1 Comments

Sorted by latest first Latest Oldest Best

 

@Candy875

If your .htaccess has RewriteRules like these:

RewriteRule page.html /another-page.html [NC,R=301,L]


It will always remove querystring parameters, that's default behaviour. You'll have to add QSA flag to your RewriteRule, like this:

RewriteRule page.html /another-page.html [NC,QSA,R=301,L]


Apache mod_rewrite doc
QSA|qsappend

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme