AI 爬蟲對 WordPress 的影響及如何簡單快速阻擋 AI 爬蟲。

近年來由於 AI 快速發展,AI 爬蟲也愈來愈顯誇張。不管是正規爬蟲還是中國的不講武德的大量亂爬。對於那種小型的 WordPress 網站造成大量的資源損耗。三不五時 CPU 飆高。網站因為吃資源太多被鎖。這篇文章教你幾種簡單快速方式阻擋爬蟲。

為何按裝了快取外掛 CPU 還是飆高

  • AI 爬蟲會爬搜尋結果,而通常搜尋結果是不會進快取。
  • AI 爬蟲會利用 wordpress API ,而通常 API 的回傳結果不會進快取。
  • AI 爬蟲會代 Query 參數。有參數的爬蟲不會抓快取回應。
AI bot oembed api

這些都會即時執行 PHP 程式作回應。也就會造成大量的 php 的 process 出現。除了回應變慢之外也有可能造成系統資源吃光短暫網站會連不上線,尤其是那些 5-12 美元每月的便宜主機。

解決方案一: 使用 robots.txt 擋 AI 爬蟲

User-agent: GPTBot
Disallow: /

User-agent: ChatGPT-User
Disallow: /

User-agent: OpenAI
Disallow: /

User-agent: CCBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: anthropic-ai
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: PerplexityBot
Disallow: /

User-agent: Amazonbot
Disallow: /

User-agent: Applebot-Extended
Disallow: /

User-agent: Bytespider
Disallow: /

User-agent: YandexAI
Disallow: /

User-agent: Meta-ExternalAgent
Disallow: /

User-agent: Meta-ExternalFetcher
Disallow: /

# 預設允許一般搜尋引擎
User-agent: *
Allow: /

解決方案二: 使用 .htaccess 擋 AI 爬蟲

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} (GPTBot|ChatGPT-User|ClaudeBot|CCBot|PerplexityBot|Bytespider|anthropic-ai|Google-Extended) [NC]
RewriteRule .* - [G,L]
</IfModule>

解決方案三: 使用 Cloudflare

 Security Settings -> Settings
cf block ai
cf block ai setting
blog.ocam.live
blog.ocam.live

關注科技新聞、SEO、人工智慧、電玩模擬器、程式設言、與 IT 日常等議題,深入簡出文章的說明並持續追蹤相關新聞的發展與報導。