AI .htaccess Generator

Generate .htaccess rules to actively block AI crawlers at the server level. Works with Apache and LiteSpeed servers.

Select AI Crawlers to Block

Choose which AI crawlers you want to block. Server-level blocking works even on bots that ignore robots.txt.

20 of 20 selected
Allen Institute for AI1/1
Amazon1/1
Anthropic2/2
Apple1/1
ByteDance1/1
Cohere1/1
Common Crawl1/1
Diffbot1/1
Google1/1
Meta2/2
Microsoft1/1
OpenAI3/3
Perplexity1/1
Various1/1
Webz.io1/1
You.com1/1

Response Type

Generated .htaccess rulesapache
# Block AI Crawlers
# Generated by webmaster-zone.com
# Add this to your .htaccess file in your website root

<IfModule mod_rewrite.c>
  RewriteEngine On

  RewriteCond %{HTTP_USER_AGENT} GPTBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ChatGPT-User [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} OAI-SearchBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Google-Extended [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} anthropic-ai [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} ClaudeBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} FacebookBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Meta-ExternalAgent [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Applebot-Extended [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Bytespider [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} CCBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} PerplexityBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} cohere-ai [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} YouBot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Diffbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Omgilibot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} Amazonbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} bingbot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} AI2Bot [NC,OR]
  RewriteCond %{HTTP_USER_AGENT} img2dataset [NC]

  # Return 403 Forbidden
  RewriteRule .* - [F,L]
</IfModule>

# Alternative: Block using mod_setenvif (if mod_rewrite is unavailable)
<IfModule mod_setenvif.c>
  SetEnvIfNoCase User-Agent "GPTBot" bad_bot
  SetEnvIfNoCase User-Agent "ChatGPT-User" bad_bot
  SetEnvIfNoCase User-Agent "OAI-SearchBot" bad_bot
  SetEnvIfNoCase User-Agent "Google-Extended" bad_bot
  SetEnvIfNoCase User-Agent "anthropic-ai" bad_bot
  SetEnvIfNoCase User-Agent "ClaudeBot" bad_bot
  SetEnvIfNoCase User-Agent "FacebookBot" bad_bot
  SetEnvIfNoCase User-Agent "Meta-ExternalAgent" bad_bot
  SetEnvIfNoCase User-Agent "Applebot-Extended" bad_bot
  SetEnvIfNoCase User-Agent "Bytespider" bad_bot
  SetEnvIfNoCase User-Agent "CCBot" bad_bot
  SetEnvIfNoCase User-Agent "PerplexityBot" bad_bot
  SetEnvIfNoCase User-Agent "cohere-ai" bad_bot
  SetEnvIfNoCase User-Agent "YouBot" bad_bot
  SetEnvIfNoCase User-Agent "Diffbot" bad_bot
  SetEnvIfNoCase User-Agent "Omgilibot" bad_bot
  SetEnvIfNoCase User-Agent "Amazonbot" bad_bot
  SetEnvIfNoCase User-Agent "bingbot" bad_bot
  SetEnvIfNoCase User-Agent "AI2Bot" bad_bot
  SetEnvIfNoCase User-Agent "img2dataset" bad_bot
</IfModule>

<IfModule mod_authz_core.c>
  <RequireAll>
    Require all granted
    Require not env bad_bot
  </RequireAll>
</IfModule>

Server Compatibility

These rules work with Apache and LiteSpeed servers. For Nginx, you will need to convert these to Nginx configuration format. For Cloudflare, use their Bot Management or Firewall Rules.

How to Use

  1. 1Copy the generated .htaccess rules above or download the file.
  2. 2Open your existing .htaccess file in the root of your website. Create one if it does not exist.
  3. 3Add the generated rules at the top of your .htaccess file, before any existing rules.
  4. 4Save and upload the file. Changes take effect immediately - no server restart needed.

Why use .htaccess?

Unlike robots.txt, .htaccess rules are enforced at the server level. Bots cannot ignore them - they simply do not receive any content. This is the most reliable way to block unwanted crawlers.