GICT knowledge base
How to Block AI Bots Using Robots.txt
Published
Many AI bots visit websites every day. These bots collect data to train AI systems. They use your content without asking you. Many website owners do not like this. They want to control who can use their content. The robots.txt file helps you block these bots. This guide shows you simple steps to protect your website. You do not need any technical skills for this.
What is Robots.txt?
Robots.txt is a text file on your website. It tells bots which pages they can see. Good bots read this file first before visiting your site. The file stays in your main website folder.
You can see it at yourwebsite.com/robots.txt
The file has simple rules. Each rule tells a bot what it can do or cannot do on your site.
Why Block AI Bots?
There are many reasons to block AI bots.
First, they use your original content to train their AI models. You worked hard to create that content. You may not want others using it for free.
Second, these bots use your server space and bandwidth. This costs you money. Too many bot visits can slow down your website.
Third, your content is your property. You should decide who can access it and use it.
Fourth, if you run a business, your content gives you an edge. Protecting it helps your business grow.
Common AI Bots
Many companies run AI bots. Here are the main ones you should know:
- GPTBot – Made by OpenAI. It collects data for ChatGPT.
- ChatGPT-User – Another OpenAI bot for training models.
- Google-Extended – Google’s AI bot. It is different from regular Google search.
- CCBot – Run by Common Crawl. Many AI companies use its data.
- anthropic-ai – Collects data for Claude AI.
- Claude-Web – Another bot by Anthropic for AI training.
- Bytespider – TikTok’s web crawler bot.
- PerplexityBot – Works for Perplexity AI search.
- FacebookBot – Collects data for Meta’s AI work.
- Applebot-Extended – Apple’s AI training bot.
- Diffbot – AI data extraction bot.
- Omgilibot – Used by various AI services.
How to Block AI Bots
Blocking bots is very easy. You just add simple lines to your robots.txt file.
Step 1: Block Each Bot Separately
User-agent: GPTBot
Disallow: /
User-agent: Google-Extended
Disallow: /
User-agent: CCBot
Disallow: /
User-agent: anthropic-ai
Disallow: /
User-agent: Bytespider
Disallow: /
User-agent: PerplexityBot
Disallow: /
User-agent is the name of the bot. Disallow means stop. The slash means the whole website. So these lines tell each bot to stay away from your full site.
Step 2: Block Many Bots Together
User-agent: GPTBot
User-agent: Google-Extended
User-agent: CCBot
User-agent: anthropic-ai
Disallow: /
This saves space and works the same way.
Step 3: Block Only Some Pages
User-agent: GPTBot
Disallow: /blog/
Disallow: /members/
This blocks bots from your blog and members area. They can still see other pages.
Step 4: Keep Search Engines Working
User-agent: Googlebot
Allow: /
User-agent: Bingbot
Allow: /
User-agent: GPTBot
Disallow: /
User-agent: Google-Extended
Disallow: /
Googlebot and Bingbot have Allow. This means they can visit. AI bots have Disallow. This means they cannot visit. Your site stays in search results but AI bots stay out.
Steps to Add Robots.txt
- Log into your website hosting. Use your control panel or FTP program.
- Find your main website folder. It is usually called public_html or www.
- Look for robots.txt file. If you find it, open it. If you do not find it, make a new text file.
- Add the blocking rules. Copy the code from above. Be careful with spelling.
- Save the file as robots.txt. Upload it to your main folder.
- Check if it works. Type yourwebsite.com/robots.txt in your browser. You should see your rules.
Important Points
- Robots.txt is a request. Good bots follow it. Bad bots can ignore it. Most big companies respect the rules. Small or bad actors may not.
- Never block Google or Bing by mistake. If you do, your site will disappear from search. Check your file carefully.
- Update your file often. New AI bots come out all the time. Add them to your list every few months.
- Spelling matters a lot. One wrong letter can break everything. Use a simple text editor. Check your work twice.
- Make a backup. If you already have a robots.txt file, save a copy before you change it. This helps if something goes wrong.
Does This Really Work?
Yes, it works for most bots. Big companies like OpenAI, Google, and Anthropic say they follow robots.txt rules. They respect your choices.
But some bots may not listen. Some small companies or bad actors ignore the file. For them, you need other tools like server blocking or firewall rules.
Still, robots.txt is the best first step. It is easy to use and works well for most cases.
Check Your Results
After you add the file, watch your website stats. Most hosting panels show you which bots visit your site. Check if AI bot visits go down.
You can also use Google Search Console. This tool shows you if search bots can still access your site. Make sure everything works right.
If you see problems, go back and check your robots.txt file. Fix any mistakes you find.
Conclusion
Blocking AI bots with robots.txt is simple and works well. It gives you control over your content. The setup takes just a few minutes. It saves your bandwidth and protects your work. Always remember to keep search engines allowed. People need to find your site on Google and Bing. Update your robots.txt file regularly when new bots appear. Start today and take control of your website content.
Related guides
How to Protect SSH with CrowdSec on Ubuntu
Protect SSH with CrowdSec on Ubuntu. Connect log detection to firewall enforcement and test temporary blocking without losing administrator access.
Website SecurityHow to Secure the Ollama API with Nginx
Protect a private Ollama API with Nginx authentication and restricted routes. Verify allowed requests, denied management calls and direct-port isolation.
Website SecurityHow to Protect a Web App with Authelia
Protect an app with Authelia and Nginx. Keep the backend private, configure password authentication and test permitted and denied user access.
Website SecurityHow to Manage Let’s Encrypt SSL Certificates with Certbot Commands
Learn to manage Let's Encrypt SSL certificates using Certbot commands for installation, renewal, and configuration to keep your site secure.
