---
# System prepended metadata

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

---

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

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

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

* root網站根目錄寫法: ( 例: https://example.com/ )
```apache=
<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
```

* 非root網站子目錄寫法: ( 例: https://example.com/test/abc/ )
```apache=
<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時移除所有參數

* root網站根目錄寫法: ( 例: https://example.com/ )
```apache=
<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/
```

* 非root網站子目錄寫法: ( 例: https://example.com/test/abc/ )
```apache=
<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/
```

### 資料來源

* [What is fbclid? the new facebook parameter - Stack Overflow](https://stackoverflow.com/questions/52847475/what-is-fbclid-the-new-facebook-parameter)
* [Rewrite note. 重寫規則筆記](https://blog.hinablue.me/apache-note-about-some-rewrite-note-2011-05/)
* [htaccess重新導向 帶參數頁面一對一轉址語法](https://www.awoo.com.tw/blog/2014/09/htaccess-redirect-%E9%87%8D%E6%96%B0%E5%B0%8E%E5%90%91/)
* [網址自帶fbclid是什麼？臉書第一方像素對GA/短網址的影響](https://medium.com/picsee-official/facebook%E6%96%B0%E7%89%88%E5%83%8F%E7%B4%A010-24%E9%96%8B%E8%B7%91-%E8%87%AA%E5%B8%B6%E5%85%A5fbclid%E7%B6%B2%E5%9D%80%E5%8F%83%E6%95%B8%E7%9A%84%E5%9B%A0%E6%87%89%E5%BB%BA%E8%AD%B0-51c65b147f1)
    * 這篇有Google Analytics中過濾掉fbclid參數的設定方法


## 使用者端

### 使用瀏覽器擴充功能移除

* [如何自動移除網址的 fbclid 與 UTM 參數 | Vixual](http://www.vixual.net/blog/archives/129)