last day (16 days later) » 

2:48 PM
1
A: How do I simply add a forward slash "/" to a redirect rule and keep the UTM/Google Tracking parameters

MrWhiteAssuming you have a single path segment that can consist of the characters a-z, A-Z, 0-9, _ (underscore) and - (hyphen). Try something like the following near the top of your .htaccess file, before the existing WordPress front-controller: RewriteRule ^([\w-]+)$ /$1/ [R=302,L] This directive m...

 
Thank you! That works!
This works except that the Ad company uses + in their Campaign Name. "utm_campaign=AdComp.com+PPC+Location+-+Geo-Modified..." It will drop the campaign in this instance when no "/" is added. Any advice, @MrWhite
 
That's presumably all part of the query string? In which case it shouldn't make any difference. What is the full URL? Maybe the URL-path contains different characters or multiple path segments (so it's not matched by the above rule)?
 
Here is a link that does what the other does...but is tracked differently.
 
The above rule (by itself) works OK with that URL. I had a look at the URL on your site and it seems that part of the query string is actually getting removed? That's not something the above directive would do. Maybe there is a conflict with other directives in your config file? Having tried a few other URLs on your site, it doesn't always append the slash (are these pulled from a server-side cache)? If you add the contents of your .htaccess file to your question I'll take a look. server: openresty - is Apache behind this?
 
it has been updated and added as requested.
 
2:48 PM
It seems you've put the directives in the wrong place. This directive needs to go before, not after the WordPress front-controller! I've updated my answer.
 
Not sure how long it should reflect the change. However, it is still persisting.
 
At least now it's redirecting requests like /foo, whereas previously it didn't. However, this doesn't necessarily explain why part of the query string is being removed, as in youir example above. This directive by itself cannot cause that (it doesn't do anything with the query string) and I can't see anything else in your config file that would cause that. I've tried various URLs and can't really explain the behaviour!? It appears to remove a (random-like) "chunk" of the query string - it's not simply an issue with +. Other URLs with + work OK. (?)
However, an "unknown" here is that you appear to be using a caching proxy server... the response we are seeing is coming from an "openresty" server, not Apache?
 
Could that be due to using a CDN like StackPath?
 
I'm not sure; possibly.
 
@MrWhite, thank you for your help. For some reason, it's not working again. I moved the code as you suggested. I tested it out with simple ?gclid=test. It works when there's a "/" and only on the home page without the "/"...but all other pages it disappears on redirect. I have moved the code back to the end.
 

  last day (16 days later) »