To block access to your site for an AI bot, you need to write the following instruction in the .htaccess file:
1 2 |
RewriteCond %{HTTP_USER_AGENT} ^.*(ChatGPT-User|ClaudeBot|PerplexityBot).*$ [NC] RewriteRule .* - [F,L] |
Now, each bot that is specified in the instructions in brackets, when trying to scan a page of your site, will receive a 403 – Forbidden response.
In brackets, through |, you need to list the names of the bots that want to be blocked.
You can look up the names of the bots in the log file: /var/log/apache2/other_vhosts_access.log
For example, for ChatGPT there will be lines like this:
your_site.com … “GET … HTTP/1.1” 304 2798 “-” “Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot”
where “ChatGPT-User” is the name of the bot.