DR Meter

AhrefsBot Firewall Rule Generator

Generate ready-to-paste rules to allow or block AhrefsBot — built from Ahrefs' official, live crawler IP ranges.

Mode

Format

IP ranges are fetched live from Ahrefs and can change. Regenerate periodically to stay current.

What is AhrefsBot?

AhrefsBot is the web crawler Ahrefs uses to build its backlink index — one of the most active SEO crawlers on the web. Blocking it hides your site from Ahrefs' link data (and from competitors analysing you), but does not affect your Google rankings.

How to block AhrefsBot

There are four common ways to control AhrefsBot. The generator above builds each from Ahrefs' live IP ranges; the examples below show the shape of each rule.

robots.txt

The polite method: the genuine AhrefsBot obeys robots.txt. Add a rule to disallow it site-wide. Note this is a request, not enforcement — it will not stop a spoofed bot.

User-agent: AhrefsBot
Disallow: /

.htaccess (Apache)

Block by user-agent or by IP range at the Apache level, returning 403 to AhrefsBot.

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} AhrefsBot [NC]
RewriteRule .* - [F,L]

Nginx

Deny AhrefsBot by user-agent or by its IP ranges inside your server block.

if ($http_user_agent ~* (AhrefsBot)) {
    return 403;
}

Cloudflare

Create a WAF custom rule matching AhrefsBot's IP ranges (or user-agent) and set the action to Block.

(http.user_agent contains "AhrefsBot")   →   Action: Block

AhrefsBot IP Checker →

Should you block AhrefsBot?

Blocking AhrefsBot is a trade-off, not a best practice. Block it if you want to keep your backlink profile hidden from competitors' research, or to save crawl bandwidth on a large or resource-constrained site. Keep it allowed if you use Ahrefs yourself — blocking it also blinds your own reports — or if you want your link-building wins to show up in the tools your clients and partners use. Either way, it has no effect on Google.

robots.txt vs firewall: request vs enforcement

A robots.txt rule is a polite request — the genuine AhrefsBot obeys it, but a spoofed crawler ignores it entirely. A firewall or WAF rule is enforcement: it drops the connection regardless of what the bot claims to be. Use robots.txt to control the real, well-behaved AhrefsBot; use IP-based firewall rules when you need to stop a crawler that is ignoring robots.txt or faking the user-agent.

Verify before you allow or block

Whichever direction you choose, base your IP rules on verified data. Before you allowlist an IP as AhrefsBot, confirm it with the AhrefsBot IP Checker (range plus reverse and forward DNS) so you do not accidentally whitelist a spoofer. Before you block by IP, regenerate your rules from the live ranges so you are not working from a stale list — or accidentally blocking a legitimate visitor who now holds a recycled address.

Where to apply the rule

The best place to enforce a block depends on your stack. The generator gives you the right snippet for each; pick the layer closest to the edge that you control:

  • Cloudflare or another CDN/WAF — a custom rule here stops the bot before it reaches your server (most efficient)
  • Nginx or Apache (.htaccess) — block at the web server when you have no CDN in front
  • WordPress and other CMSes — use a security plugin or drop the .htaccess rule in your web root
  • robots.txt — for the well-behaved, genuine AhrefsBot only; combine it with an IP rule for enforcement

How many top websites block AhrefsBot? →

Frequently asked questions

Should I block AhrefsBot?

Only if you do not want your backlinks in Ahrefs' index, or you want to save crawl bandwidth. Blocking AhrefsBot has no effect on your Google rankings.

Does blocking AhrefsBot hurt my SEO?

No. AhrefsBot is not Google. Blocking it only removes your site from Ahrefs' link database; Googlebot and your rankings are unaffected.

Will AhrefsBot respect robots.txt?

The genuine AhrefsBot obeys robots.txt. Bots that ignore it are likely spoofing the user-agent — block those by IP range instead.