Apakah Anda melihat banyak lalu lintas ke situs Anda dari bot yang buruk? Jika Anda memiliki situs WordPress, mungkin reaksi pertama adalah mencari plugin WordPress yang akan memblokir kunjungan semacam itu. Namun alih-alih menggunakan plugin WordPress gratis/berbayar, Anda juga dapat memodifikasi file .htaccess dari root situs Anda. Lokasi file biasanya di /home/username/public_html/.htaccess.
Cukup edit file dan tambahkan baris ini:
#Rules to block bad bods from accessing web pages on your site.
#Remove or add more rules as per your needs.
BrowserMatchNoCase "Baiduspider" bots
BrowserMatchNoCase "SemrushBot" bots
BrowserMatchNoCase "Yandex" bots
BrowserMatchNoCase "BLEXBot" bots
BrowserMatchNoCase "AhrefsBot" bots
BrowserMatchNoCase "DotBot" bots
BrowserMatchNoCase "Exabot" bots
BrowserMatchNoCase "SeznamBot" bots
BrowserMatchNoCase "aiHitBot" bots
BrowserMatchNoCase "spbot" bots
BrowserMatchNoCase "MJ12bot" bots
BrowserMatchNoCase "oBot" bots
BrowserMatchNoCase "DeuSu" bots
BrowserMatchNoCase "ia_archiver" bots
BrowserMatchNoCase "MetaURI" bots
BrowserMatchNoCase "FlipboardProxy" botsOrder Allow,Deny
Allow from ALL
Deny from env=bots
Bot ini sekarang akan mendapatkan Kesalahan HTTP 403 saat mencoba mengakses halaman Anda.
Dengan menggunakan file .htaccess, Anda juga dapat memblokir IP yang buruk. Jika Anda mengetahui IP berbahaya, tambahkan seperti:
#Deny malicious bots/visitors by IP addresses.
deny from 118.244.181.33
deny from 82.102.230.83