To block Ahrefs, Moz and Majestic, add one robots.txt group per crawler at the root of your domain and disallow everything. The three user-agent tokens you need are AhrefsBot, rogerbot and dotbot for Moz, and MJ12bot for Majestic. All three vendors document that their crawlers obey robots.txt, so the directives below are honoured within a crawl cycle or two.
Before you paste them, be clear about what blocking actually achieves — because the most common reason people give for doing it is the one thing it does not accomplish.
The copy-ready robots.txt block
Put this in a plain text file at the root of your site, reachable at yourdomain.com/robots.txt. Each crawler gets its own group, separated by a blank line.
- User-agent: AhrefsBot
- Disallow: /
- User-agent: AhrefsSiteAudit
- Disallow: /
- User-agent: rogerbot
- Disallow: /
- User-agent: dotbot
- Disallow: /
- User-agent: MJ12bot
- Disallow: /
- User-agent: SemrushBot
- Disallow: /
Moz needs two entries because it runs two crawlers: rogerbot is the Moz Pro campaign crawler that audits sites inside the product, and dotbot is the crawler that builds the Link Explorer web index. Blocking one and not the other is the usual mistake.
Ahrefs also runs two: AhrefsBot builds its public index, and AhrefsSiteAudit is the crawler its Site Audit tool uses on your own site. Block AhrefsSiteAudit only if you never intend to run Ahrefs' free Webmaster Tools audits on your own domain — otherwise you will have disabled a tool you might want.
Semrush runs several named bots including a separate site-audit agent, so if a full block is the goal, check their current bot documentation rather than assuming one token covers everything.
Other crawlers worth adding
If your goal is reducing bot load rather than hiding from one competitor, these are the SEO and data crawlers that most commonly show up in access logs.
- User-agent: BLEXBot
- Disallow: /
- User-agent: DataForSeoBot
- Disallow: /
- User-agent: Barkrowler
- Disallow: /
- User-agent: SeekportBot
- Disallow: /
Add them one at a time and watch your logs. Blocking a crawler you have never actually been visited by adds maintenance with no benefit.
What blocking these crawlers does and does not do
This is the part that changes the decision for most people.
- It does hide your site's pages and outbound links from those tools. Competitors will not be able to see your internal link structure, your content footprint, or where you link out.
- It does not remove your backlinks from their indexes. The links pointing at you live on other people's websites. Those crawlers still visit those sites, still see the link, and still attribute it to your domain. If your goal is stopping a competitor from seeing who links to you, blocking your own server does not achieve it.
- It does reduce server load and bandwidth. This is the honest, boring, best reason to block. Aggressive crawlers on a large site can consume a meaningful share of origin requests.
- It does not affect Google or Bing. Googlebot and Bingbot are separate user-agents and are unaffected by any of the rules above. Your organic rankings do not change because you blocked AhrefsBot.
- It does not hide anything. Your robots.txt is a public file. Anyone can read it and see exactly which crawlers you decided to block, which is itself a signal some people would rather not send.
- It does break your own tooling. If you block a vendor's crawler and later subscribe to that vendor, their site audit will not work on your domain until you unblock it.
Blocking AI crawlers: GPTBot, ClaudeBot, PerplexityBot
The same mechanism controls AI training and answer-engine crawlers, and this is where most of the current interest actually sits. These are the tokens the major providers document.
- User-agent: GPTBot
- Disallow: /
- User-agent: OAI-SearchBot
- Disallow: /
- User-agent: ChatGPT-User
- Disallow: /
- User-agent: ClaudeBot
- Disallow: /
- User-agent: Claude-User
- Disallow: /
- User-agent: PerplexityBot
- Disallow: /
- User-agent: CCBot
- Disallow: /
- User-agent: Google-Extended
- Disallow: /
- User-agent: Applebot-Extended
- Disallow: /
- User-agent: Bytespider
- Disallow: /
- User-agent: Amazonbot
- Disallow: /
- User-agent: meta-externalagent
- Disallow: /
Three distinctions matter more than the list itself.
Training crawlers versus answer crawlers are not the same thing. GPTBot and CCBot gather content for model training. OAI-SearchBot and PerplexityBot build the indexes those assistants search when answering a live question. Claude-User and ChatGPT-User fetch a page because a user asked about it right now. Blocking the training bots protects your content from being learned. Blocking the answer bots removes you from the results those products cite — a very different outcome.
Google-Extended is not a Search opt-out. Google documents it as controlling whether your content helps improve its generative products, and states that it does not affect inclusion or ranking in Google Search. Because AI Overviews are part of Search, opting out of Google-Extended is not a way to stay out of them. Applebot-Extended works similarly for Apple: it governs training use, not Apple's search crawler. Check both vendors' current documentation before relying on either.
Blocking answer engines has a real cost. AI assistants are becoming a discovery channel in their own right. If a model cannot fetch your page, it cannot cite you, and it will cite a competitor who left the door open. Blocking training crawlers while allowing the retrieval and search bots is the position most publishers land on, and it is a defensible middle ground.
If you would rather be visible to AI assistants than hidden from them, that is a different project. An llms.txt file gives assistants a curated map of your most useful pages — you can generate one with our free llms.txt generator, and check how machine-readable your site currently is with the agent-ready score checker. Note that llms.txt is an emerging convention rather than a standard any provider has committed to honouring, so treat it as low-cost insurance, not a ranking lever.