·8分で読める

robots.txtでAIボットを制御する完全ガイド

GPTBot・ClaudeBot・PerplexityBotなど主要AIボットのrobots.txt設定を完全網羅。Allow/Disallowの書き方、確認方法、注意点まで解説します。

robots.txtAIボットクロール制御

robots.txtとAIボット

robots.txtはWebサーバーのルートディレクトリに設置するテキストファイルで、クローラーに対してアクセス可否を伝えるための業界標準です。GooglebotをはじめOpenAI・Anthropic・Perplexityなどの主要AIクローラーはrobots.txtを遵守すると宣言しています。

主要AIボットのUser-Agent一覧

User-Agent企業
GPTBotOpenAI(学習)
OAI-SearchBotOpenAI(検索)
ChatGPT-UserOpenAI(ブラウジング)
ClaudeBotAnthropic(学習)
anthropic-aiAnthropic(検索)
PerplexityBotPerplexity
Google-ExtendedGoogle(Gemini学習)
Applebot-ExtendedApple(AI学習)
BytespiderByteDance
cohere-aiCohere
YouBotYou.com
CCBotCommon Crawl

全AIボットを一括ブロックする設定

# 全AIボットをブロック
User-agent: GPTBot
Disallow: /

User-agent: OAI-SearchBot
Disallow: /

User-agent: ChatGPT-User
Disallow: /

User-agent: ClaudeBot
Disallow: /

User-agent: anthropic-ai
Disallow: /

User-agent: PerplexityBot
Disallow: /

User-agent: Google-Extended
Disallow: /

User-agent: Applebot-Extended
Disallow: /

User-agent: Bytespider
Disallow: /

User-agent: cohere-ai
Disallow: /

User-agent: YouBot
Disallow: /

User-agent: CCBot
Disallow: /

特定ページのみ許可する場合

# /about と /contact は許可、それ以外はブロック
User-agent: GPTBot
Allow: /about
Allow: /contact
Disallow: /

Googleボットは通常通り許可しつつAIのみブロック

# 通常の検索クローラーは許可(省略することで全許可)
User-agent: *
Allow: /

# AIボットのみブロック
User-agent: GPTBot
Disallow: /

User-agent: ClaudeBot
Disallow: /

サイトマップURLの追加

Sitemap: https://yourdomain.com/sitemap.xml

robots.txtの確認方法

設置後は以下のURLでブラウザから確認できます。

https://yourdomain.com/robots.txt

Google Search Consoleの「robots.txtテスター」でも動作確認が可能です。

robots.txtの限界と補完策

robots.txtはあくまで「申告制」のブロックです。ルールを無視する悪意あるクローラーや、User-Agentを偽装したクローラーには効果がありません。より確実なブロックには以下を組み合わせることを推奨します:

  • Next.js Middleware / Nginx でのHTTP 402レスポンス(Tollgate方式)
  • Cloudflare WAFカスタムルール
  • AI Access Monitorによる計測・可視化

Next.jsプロジェクトでのrobots.ts(推奨)

Next.js 13以降では src/app/robots.ts でプログラマティックに生成できます。

import { MetadataRoute } from "next";

export default function robots(): MetadataRoute.Robots {
  return {
    rules: [
      { userAgent: "*", allow: "/" },
      { userAgent: "GPTBot", disallow: "/" },
      { userAgent: "ClaudeBot", disallow: "/" },
      { userAgent: "PerplexityBot", disallow: "/" },
    ],
    sitemap: "https://yourdomain.com/sitemap.xml",
  };
}

AI Access Monitor

まず計測から始めよう

1行のコード追加で、AIクローラーの計測を今日から開始。無料・設定不要。

無料で始める →