htaccess的重写URL附加谷歌广告活动追踪导致重定向循环 [英] htaccess rewrite URL to append Google campaign tracking causing redirect loop

查看:137
本文介绍了htaccess的重写URL附加谷歌广告活动追踪导致重定向循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正试图跟踪离线广告使用指向我们的主网站的网址别名。我们需要追加谷歌分析系列跟踪code到URL的末尾时所访问的别名域之一。

We are attempting to track offline campaigns to using aliased URLs that point to our main site. We need to append Google analytics campaign tracking code to the end of the URL when the domain is one of the aliased domains.

下面重定向追加正确的信息,但会导致重定向循环,我将承担因的RewriteCond仍然匹配的规则被应用后为真。

The following redirect appends the correct information but causes a redirect loop, which I would assume because the RewriteCond still matches as true after the RewriteRule is applied.

RewriteCond %{HTTP_HOST} ^bikerhelp911\.com$
RewriteRule (.*) http://bikerhelp911.com/?utm_source=bikerhelp911.com&utm_medium=radio&utm_campaign=Radio%2BCampaign$1 [R=302,L]

我觉得我可能这样做了错误的方式,或使其更复杂得多它需要。

I feel like I'm probably doing this the wrong way or making it more complicated than it needs to be.

推荐答案

更​​改code到这一点:

Change your code to this:

RewriteCond %{QUERY_STRING} !utm_campaign= [NC]
RewriteCond %{HTTP_HOST} ^bikerhelp911\.com$
RewriteRule ^(.*)$ /?utm_source=bikerhelp911.com&utm_medium=radio&utm_campaign=Radio%2BCampaign$1 [R=302,L,QSA]

这篇关于htaccess的重写URL附加谷歌广告活动追踪导致重定向循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆