简体   繁体   English

htaccess将Google广告系列跟踪附加到别名网址

[英]htaccess append Google campaign tracking to aliased url

Sorry for duplicating the thread ( htaccess rewrite URL to append Google campaign tracking causing redirect loop ) but the other one requires 50 points to post a comment which I don't have 很抱歉复制线程( htaccess重写URL来添加Google广告系列跟踪,导致重定向循环 ),但另一个需要50分才能发表我没有的评论

I have this simple alias in my .htaccess 我的.htaccess中有这个简单的别名

RewriteCond %{REQUEST_URI} /contact$
RewriteRule .* /content.php?id=17 [L]

and I'm using analytics tracking so need to add a QS like 而且我正在使用分析跟踪,因此需要添加一个QS

?utm_source=somesource&utm_medium=email&utm_campaign=somecode

to my alias. 以我的别名。

I tried change it in .htaccess to the following but neither of them work: 我尝试在.htaccess中将其更改为以下内容,但它们都不起作用:

RewriteCond %{REQUEST_URI} /contact$
RewriteRule .* /content.php?id=17 [L,QSA]

RewriteCond %{REQUEST_URI} /contact$
RewriteRule .* /content.php?id=17&%{QUERY_STRING} [L]

How to catch the query string then? 那么如何捕获查询字符串呢?

Thank you 谢谢

用以下代码替换所有代码:

RewriteRule ^contact/?$ content.php?id=17 [L,QSA,NC]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM