# How to stop bots on your website

> Start by measuring which bots hit which pages, using server or CDN logs rather than analytics alone. Then turn on free controls: your CDN's bot setting, rate limits and verified crawler rules. Next protect the pages bots target, such as login, signup, checkout and forms, with checks fitted to each one. Add dedicated bot management when attackers adapt to the simple controls.

Category: Blocking bots in practice. Level: Basic. Updated: 2026-11-24.
Canonical page: https://stopbots.io/learn/implementation/how-to-stop-bots-on-your-website/

The goal is to stop the few kinds of bots that cost you money, such as account attacks, card testing, content scraping and fake signups, while useful crawlers keep their access. Work in stages. Each stage is cheaper than the next, and what you learn in one tells you whether you need the next.

## Stage 1: find out what bots are doing on your site

Use server logs or CDN logs, not only your analytics. Analytics tools count visitors that run their JavaScript tag, and Google Analytics already drops known bots, so the bots that hit your login form or API often never show up there. Our guide to [bot traffic in GA4](https://stopbots.io/learn/ad-fraud/bot-traffic-in-ga4.md) covers what analytics can and cannot see.

In the logs, look for these patterns:

- One path getting far more POST requests than page views, such as `/login` or `/checkout`.
- A high ratio of failed to successful logins, or many password reset requests.
- Signups that never confirm their email, and failed card payments in small amounts.
- Traffic from hosting providers. Every IP address belongs to a network with an ASN (autonomous system number), and real shoppers rarely browse from cloud servers.
- User agents that claim to be Googlebot but come from networks Google does not use.

A quick first check on an nginx server with the default log format lists the top addresses posting to your login page:

```bash
awk '$6 ~ /POST/ && $7 ~ /^\/login/ {print $1}' /var/log/nginx/access.log | sort | uniq -c | sort -rn | head -20
```

The [guide to detecting bot traffic](https://stopbots.io/learn/detection/how-to-detect-bot-traffic.md) goes through more signals. By the end of this stage you should know which pages are attacked, by what kind of traffic, and what it costs you.

## Stage 2: turn on the free controls

These take an afternoon and cut much of the noise from scripts and scanners.

- Put a CDN in front of the site and turn on its free bot setting. On Cloudflare that is Bot Fight Mode; the [Cloudflare guide](https://stopbots.io/learn/implementation/block-bots-with-cloudflare.md) explains the plan differences and the API side effects.
- Add rate limits to login, signup, password reset, OTP and search endpoints. The [rate limiting guide](https://stopbots.io/learn/implementation/are-rate-limits-enough-to-stop-bots.md) explains where they work and where they fail.
- Block what you never want at the server: empty user agents on form posts, known scraper tools, and xmlrpc.php if you run WordPress. The [nginx and Apache guide](https://stopbots.io/learn/implementation/block-bots-with-nginx-and-apache.md) has the config.
- Allow search engines by checking their identity with a reverse DNS lookup, since anyone can copy a crawler's user agent. See [how to verify Googlebot and other good bots](https://stopbots.io/learn/scraping/how-to-verify-good-bots.md).
- Use robots.txt to tell well behaved crawlers, including AI crawlers, what to skip. It is a request, and scrapers ignore it.

If you run a hosted platform, start with the platform guide instead: [WordPress](https://stopbots.io/learn/implementation/stop-bots-on-wordpress.md) or [Shopify](https://stopbots.io/learn/implementation/stop-bots-on-shopify.md).

## Stage 3: protect each endpoint bots target

Generic site-wide rules miss attacks that send a few valid-looking requests to one page. Give each sensitive endpoint its own control.

| Endpoint | Typical bot attack | Where to start |
|---|---|---|
| Login | Credential stuffing | Limits per IP and per username, breached password checks, step-up checks on risk |
| Signup | Fake accounts | Email and phone checks, linking devices across accounts |
| Checkout and payment | Card testing | Limits per session, card and BIN, your payment provider's fraud rules |
| Contact and lead forms | Spam | Honeypot fields and server-side validation |
| Product, price and search pages | Scraping | Limits per client, challenges on suspicious sessions |
| SMS and OTP | SMS pumping | Limits per phone prefix and per session |

Each row has a full guide: [preventing credential stuffing](https://stopbots.io/learn/account-attacks/how-to-prevent-credential-stuffing.md), [stopping card testing](https://stopbots.io/learn/ecommerce-fraud/how-to-stop-card-testing.md) and [stopping form spam](https://stopbots.io/learn/ad-fraud/how-to-stop-form-spam.md). Mobile apps and public APIs need different tools, because browser challenges cannot run there; see [how to protect APIs from bots](https://stopbots.io/learn/implementation/how-to-protect-apis-from-bots.md).

When you add a challenge, prefer an invisible check over a puzzle on every visit. Puzzles cost conversions and paid solving services get through them. [CAPTCHA alternatives](https://stopbots.io/learn/captcha/captcha-alternatives.md) compares the options.

## Stage 4: add dedicated bot management

Move to a bot management product when you see these signs:

- Attacks continue from residential IP addresses at low rates, so IP rules and rate limits no longer catch them.
- Your blunt rules start blocking real customers.
- Losses from account takeover, card testing or scalping are higher than the cost of a tool.
- Staff spend hours each week writing and removing block rules.

Bot management adds signals your server does not have: browser and device fingerprints, TLS fingerprints, behaviour, and links between sessions that share a device. Roll it out in monitor mode first, measure how many real users it would block (see [false positives in bot detection](https://stopbots.io/learn/detection/bot-detection-false-positives.md)), then enforce one endpoint at a time. [How to choose bot protection](https://stopbots.io/learn/implementation/how-to-choose-bot-protection.md) lists the questions to ask vendors.

## Tools that help

_StopBots is published by Kairal, which is one of the tools listed. The list is not a ranking._
- [Cloudflare](https://developers.cloudflare.com/bots/) offers Bot Fight Mode and Turnstile on its free plan, which is enough for many small sites, with more bot controls on paid plans.
- [CrowdSec](https://www.crowdsec.net/) is open source and free to self-host; it reads your logs, bans abusive IP addresses and shares a community blocklist.
- [fail2ban](https://github.com/fail2ban/fail2ban) is a free, open source tool that bans IP addresses that trip rules in your server logs, a good fit for a single server.
- [Kairal](https://www.kairal.io/product/bot-protection/) connects device, network and behavioural signals across first visit, login, signup and checkout, with protection set per endpoint and a preview mode that shows decisions before it blocks anything.
- [AWS WAF Bot Control](https://aws.amazon.com/waf/features/bot-control/) adds managed bot rules to AWS WAF, which suits sites already behind CloudFront or an AWS load balancer.

## Common questions

### What causes bot traffic on a website?

Any public site gets visits from search crawlers, SEO tools, uptime monitors, AI crawlers and scanners looking for known weaknesses. Targeted bot traffic starts when a site holds something worth taking, such as accounts, limited stock, prices, content or a payment form that can check stolen cards.

### Is bot traffic bad?

Some of it is useful. Search engine crawlers and monitoring services do work you want done. Bots become a problem when they take something from you: account access, inventory, content, ad budget, SMS credit or server capacity.

### How do I block bot traffic for free?

A free CDN plan with its bot setting on, rate limits on login and form endpoints, a honeypot field on forms and a free challenge such as Cloudflare Turnstile cover the common attacks on a small site. Open source tools like fail2ban or CrowdSec can ban abusive IP addresses based on your own server logs.

## Related

- [What is bot management?](https://stopbots.io/learn/bots/what-is-bot-management.md)
- [How to detect bot traffic on your website](https://stopbots.io/learn/detection/how-to-detect-bot-traffic.md)
- [How to choose bot protection software](https://stopbots.io/learn/implementation/how-to-choose-bot-protection.md)
- [How to block bots with Cloudflare](https://stopbots.io/learn/implementation/block-bots-with-cloudflare.md)
