.htaccess Bot Blocker Generator (403 for Bad Bots)

Generates Apache rules that refuse requests from the user-agents you list.

Use the tool

Why this tool exists

On shared Apache hosting, .htaccess is often the only place you can refuse a crawler. Two ways work: mod_rewrite with a condition on the user-agent, or SetEnvIf with Require not env.

List the bot names and pick the method. The rules block anything whose user-agent contains the names, so double check the list. A typo in .htaccess can cause a 500 error, so keep a backup.

How to use it

  1. List bot tokens.
  2. Choose mod_rewrite or SetEnvIf.
  3. Add the rules to .htaccess.
  4. Test with curl -A.

Frequently asked questions

Which method is better?

SetEnvIf with Require is the Apache 2.4 style; mod_rewrite works on almost every host.

Is the match case sensitive?

No, the rules use case-insensitive flags.

Can bots bypass it?

Yes, by changing the user-agent.

Why 403?

It means forbidden and tells honest tools to stop.