✨ Robots.txt Generator

Robots.txt Generator

📐 工作原理與說明
只輸出使用者配置的 User-agent 組,組間以空行分隔;Sitemap 作為獨立指令追加在末尾;每條規則先按逗號切分 User-agent 逐個輸出,再依次輸出全部 Allow、全部 Disallow,抓取延遲非空時輸出 Crawl-delay;完全無規則時才回退為 User-agent: * 加空 Disallow,避免開頭多出的萬用字元改變規則組;全文去掉開頭的連續空行
生成控制爬蟲抓取範圍的 robots.txt。
  • 語法:User-agent 指定目標爬蟲,Disallow/Allow 控制路徑,Crawl-delay 限速,Sitemap 宣告站點地圖地址。
  • 匹配:路徑採用字首匹配,支援 * 通配與 $ 結束錨定(後者為廣泛支援的擴充套件)。
  • 含義:Disallow: / 為全站禁止;值為空則表示全部允許。
  • 侷限:robots.txt 屬君子協定,無法阻止惡意爬蟲;敏感內容必須做鑑權。
📌 常見預設(一鍵套用)

預覽

Formula & Standard References

Item Formula / Note Source / Standard
Directive syntax User-agent, Allow, Disallow, Sitemap grouped by agent RFC 9309
Matching longest match wins; Allow wins ties against Disallow RFC 9309
Wildcards * matches any sequence; $ anchors the path end RFC 9309
📌 說明
  • 每個規則組可新增多個 User-agent 與路徑規則。
  • 支援 `Allow`、`Disallow` 以及自定義 Crawl Delay。
  • 文本直接生成,可用於網站根目錄放置。