Dotifi Tutorial – How To block specific user agents on Cloudflare

Spread the love

To block specific user agents on Cloudflare, use the User Agent Blocking tool in the WAF section, while for Dotifi’s .htaccess, you can add a rule using RewriteCond and RewriteRule directives to block traffic based on the user agent. The following steps will guide you how to do this:

Cloudflare:
– Access Cloudflare Dashboard: Log in to your Cloudflare account and select your domain.
– Navigate to WAF: Go to Security > WAF, and select the Tools tab.
– User Agent Blocking: Under User Agent Blocking, select “Create blocking rule”.
– Create Rule:
Enter a descriptive name for the rule.
Specify the user agent string you want to block.
Select the action (e.g., block, challenge, or log).
Save the rule.

Dotifi (.htaccess):
Access .htaccess File:
Use FTP or a file manager in cPanel to locate and edit your .htaccess file in the root directory of your website.
Add the Block Rule:
Insert the following code, replacing EXAMPLE_USER_AGENT with the actual user agent string you want to block:
Code:

RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} “EXAMPLE_USER_AGENT”
RewriteRule ^ – [F,L]

Save the .htaccess file.