0321-2222869
Call Now
0341-2496955
0300-2418543

How to ban bad bots in .htaccess?

How to ban bad bots in .htaccess?

Many cowling bots are bad for your website or maybe you want to ban some bots so they can’t access your website.

You need to create a .htaccess file in your root directory like /public_html/.htaccess or /public_html/somefolder/.htaccess

Note: If you will use .htaccess in sub-folder then it will work only on your specific directory and still crowler can access your main website like example.com but they can’t access example.com/somefolder because of you put a restriction in this folder.

Copy and paste this code as it is in your .htaccess file and If you want to ban other bots,crowlers then you can modify this code or If you need help then open a ticket with us and we will help you in banning bad bots.

SetEnvIfNoCase User-Agent “AhrefsBot” bad_bots
SetEnvIfNoCase User-Agent “rogerbot” bad_bots
SetEnvIfNoCase User-Agent “mj12bot” bad_bots
SetEnvIfNoCase User-Agent “semrushbot” bad_bots
SetEnvIfNoCase User-Agent “sistrix” bad_bots
SetEnvIfNoCase User-Agent “searchmetricsbot” bad_bots
SetEnvIfNoCase User-Agent “archive.org_bot” bad_bots

<Limit GET POST>
order allow,deny
allow from all
deny from env=bad_bots
</Limit>