Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

A page redirects to another page using a 301 redirect in a .htaccess file. If 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:


redirects to:


Example 2:

http://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 3:


redirects to:


Example 4:


redirects to:


share|improve this question

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

share|improve this answer
tried using QSA but still same behavior – ganesh Jul 16 '14 at 5:38
@ganesh could you post your htaccess or at least an excerpt? – Binarysurf Jul 16 '14 at 15:02
RewriteRule ^home-living/furniture/([^/\.]+)\.html http://www.example.com/home-living/furniture/filter/cat/$1.html [R=301,L] Query string work fine except utm_source, utm_medium and utm_campaign. Why only these removed from query string? – ganesh Jul 17 '14 at 6:32

The trick is to add the parameters to the destination URL of your redirect. For example, if example.com/thispage redirects to example.com/thatpage, in the actual redirect, put the destination URL as example.com/thatpage?utm_medium=301&utm_source=thispage.

share|improve this answer
Please do not use our site as a means to promote yours. – John Conde Sep 8 '15 at 13:07

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.