Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.htaccess htaccess使用Google跟踪代码重写URL_.htaccess_Redirect_Url Rewriting - Fatal编程技术网

.htaccess htaccess使用Google跟踪代码重写URL

.htaccess htaccess使用Google跟踪代码重写URL,.htaccess,redirect,url-rewriting,.htaccess,Redirect,Url Rewriting,首先,对不起我的英语。。。我希望你能理解我的问题:) 我的公司发了一封电子邮件,其中包括我们网站的链接。此URL有一个跟踪活动的Google跟踪代码 不幸的是,URL错误: http://www.mysite.fr/category/mypage.html/?utm_source=source&utm_medium=medium&utm_campaign=campaign 但是在“mypage.html”和跟踪代码之间有一条斜线,它指向一个不远处的页面 我尝试了以下规则来重定向

首先,对不起我的英语。。。我希望你能理解我的问题:)

我的公司发了一封电子邮件,其中包括我们网站的链接。此URL有一个跟踪活动的Google跟踪代码

不幸的是,URL错误:

http://www.mysite.fr/category/mypage.html/?utm_source=source&utm_medium=medium&utm_campaign=campaign
但是在“mypage.html”和跟踪代码之间有一条斜线,它指向一个不远处的页面

我尝试了以下规则来重定向url,而不向每个人发送新电子邮件,但它们不起作用:

RewriteRule ^/category/mypage\.html/\?utm_source\=source\&utm_medium\=medium\&utm_capaign\=campaign$ http://www.mysite.fr/category/mypage.html?utm_source=source&utm_medium=medium&utm_campaign=campaign [R=301,L]
或:


我不知道怎么写规则。有人能帮帮我吗?

您的
重写规则有一些问题。如果要将其放入.htaccess文件中,则需要删除正则表达式中的前导斜杠(前缀),因为apache会在将其放入.htaccess文件的规则之前将其从URI中删除。其次,在
重写规则
中,无法匹配正则表达式中的查询字符串(从开始的内容)

不确定您的
重定向程序为什么不工作。这看起来不错,但如果不使用查询字符串,查询字符串会自动追加。我认为这正是您想要的,因此请删除目标中的查询字符串:

RedirectMatch 301 ^/category/mypage.html/$ http://www.mysite.fr/category/mypage.html

谢谢你的回复,我的文章是你的解决方案,我的答案是310(网络:错误太多)
RedirectMatch 301 ^/category/mypage.html/$ http://www.mysite.fr/category/mypage.html