CSchantz Wiki

Apache block bots

Apache Block bots

Basic

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} "(nikto|nmap|masscan|sqlmap|havij|acunetix|nessus|burp|metasploit|AhrefsBot|SemrushBot|MJ12bot|DotBot|Meta-ExternalAgent|Go-http-client)" [NC]
    RewriteRule ^ - [F,L]
</IfModule>

Aggressive

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} "(nikto|nmap|masscan|sqlmap|havij|acunetix|nessus|burp|metasploit|AhrefsBot|SemrushBot|MJ12bot|DotBot|Meta-ExternalAgent|Go-http-client|python-requests|libwww-perl|dirbuster|gobuster|wfuzz|whatweb|zgrab|nuclei|httpx|scrapy|mechanize|phantomjs|PetalBot|Bytespider|GPTBot|CCBot|DataForSeoBot|Zoominfobot)" [NC]
    RewriteRule ^ - [F,L]
</IfModule>

Plesk

nano /etc/httpd/conf/plesk.conf.d/httpd.conf.pre_main_global.include

Cpanel


nano /etc/apache2/conf.d/includes/pre_main_global.conf 
/scripts/restartsrv_apache && /scripts/restartsrv_apache_php_fpm