将变量 URL(附属链接)重定向到索引

Redirect variable URL (affiliate links) to index

我正在尝试将带有 google 分析标识符的合作伙伴链接重定向到我的索引,这样用户就无法看到关联公司的变量。

我尝试了以下方法,但不知何故总是什么都没有发生

RedirectMatch 301 mydomain.de/?utm_source=source&utm_medium=pmediumtype&utm_content=contenttype&utm_campaign=campaignname /

Redirect 301 mydomain.de/?utm_source=source&utm_medium=pmediumtype&utm_content=contenttype&utm_campaign=campaignname /index.php

打开的 URL 看起来像

mydomain.de/?utm_source=source&utm_medium=pmediumtype&utm_content=contenttype&utm_campaign=campaignname

我想让它打开 mydomain.demydomain.de/index.php

这些变量也有可能附加到

mydomain.de/kategorie/
mydomain.de/kategorie/kategorie/
mydomain.de/kategorie/kategorie/kategorie/
mydomain.de/kategorie/articlename.html
mydomain.de/kategorie/kategorie/articlename.html
mydomain.de/kategorie/kategorie/kategorie/articlename.html

背后总是有这些变数

?utm_source=deathpurge&utm_medium=partner&utm_content=text&utm_campaign=clan

Google url 建设者 reference

您可以在 DOCUMENT_ROOT/.htaccess 文件中使用此规则:

RewriteEngine On

RewriteCond %{QUERY_STRING} utm_source=\w+ [NC]
RewriteRule ^ /index.php? [L,R=302]