Try   HackMD

移除網址中的Facebook追蹤參數 ?fbclid=

網站端(Apache)使用 .htaccess 重新定向

移除網址中的fbclid參數,但保留其他參數

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} "^(.*)&?fbclid=[^&]+&?(.*)$" [NC] RewriteRule ^(.*)$ /$1?%1%2 [R=301,L] </IfModule>
輸入 https://example.com/?a=111&b=222&fbclid=XXXX&c=333&d=444
轉跳 https://example.com/?a=111&b=222&c=333&d=444
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /test/abc RewriteCond %{QUERY_STRING} "^(.*)&?fbclid=[^&]+&?(.*)$" [NC] RewriteRule ^(.*)$ $1?%1%2 [R=301,L] </IfModule>
輸入 https://example.com/test/abc/?a=111&b=222&fbclid=XXXX&c=333&d=444
轉跳 https://example.com/test/abc/?a=111&b=222&c=333&d=444

參數中有fbclid時移除所有參數

<IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} "fbclid=" [NC] RewriteRule (.*) /$1? [R=301,L] </IfModule>
輸入 https://example.com/?a=111&b=222&fbclid=XXXX&c=333&d=444
轉跳 https://example.com/
<IfModule mod_rewrite.c> RewriteEngine On RewriteBase /test/abc RewriteCond %{QUERY_STRING} "fbclid=" [NC] RewriteRule (.*) $1? [R=301,L] </IfModule>
輸入 https://example.com/test/abc/?a=111&b=222&fbclid=XXXX&c=333&d=444
轉跳 https://example.com/test/abc/

資料來源

使用者端

使用瀏覽器擴充功能移除