How Can I Block Bad Bots permanently, which are consuming my whole Bandwidth?

This topic has 4 replies, 2 voices, and was last updated 2 months, 2 weeks ago ago by Luca Rossi

  • Avatar: KING IT SOLUTIONS
    KING IT SOLUTIONS
    Participant
    July 25, 2024 at 03:30

    Hello Xstore Team,

    Please guide me How to Block Bad Bots? which are consuming Bandwidth.
    I want to blow below bots on urgently.
    facebookexternalhit
    SemrushBot

    You are requested to provide me some permanent solution to block such bad bots, consuming my all bandwidth.

    Attached in Screenshot of bandwidth consumption by these bots.

    Thanks & Regards,
    Pritpal Singh

    ———————————————-
    I already tried below in my .htaccess but never works for me.
    # MY BOTS WHICH ARE CONSUMING BANDWIDTH BLOCK PRITPAL SINGH #
    RewriteCond %{HTTP_USER_AGENT} ^(.*)facebookexternalhit [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)SemrushBot [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)nbot [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)feed [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)BLEXBot [NC,OR]

    # BLOCK Facebook Crawler
    # https://endurtech.com/block-facebook-crawler-facebookexternalhit/
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} ^facebookexternalhit/1\.1 [NC]
    RewriteRule ^ – [F,L]
    # BLOCK Facebook Crawler END
    —————————————————
    I also tried one plugin named: “Block Bad Bots and Stop Bad Bots Crawlers and Spiders and Anti Spam Protection” but it also done nothing and not able to block above said bots.
    —————————————————-

    Files is visible for topic creator and
    support staff only.
    3 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    July 25, 2024 at 09:47

    Dear KING IT SOLUTIONS Team,

    We hope this message finds you well. In response to your query regarding methods to block bots, we recommend utilizing the “robots.txt” file. This approach can effectively prevent bots from accessing certain parts of your website.

    For detailed guidance on creating and implementing a “robots.txt” file, please refer to the following resource provided by Google: [Create robots.txt](https://developers.google.com/search/docs/crawling-indexing/robots/create-robots-txt).

    Should you require any further assistance or have additional questions, please do not hesitate to contact us.

    Best Regards,
    The 8Theme’s Team

    Avatar: KING IT SOLUTIONS
    KING IT SOLUTIONS
    Participant
    July 30, 2024 at 06:43

    Hi there.
    I tried to block bad bots via robots.txt and .htacess but still bad bots consuming my whole bandwidth. I tried below things to get rid of bad bots but never succeeded.

    ——————-
    1. in robot.txt
    ——————
    User-agent: facebookexternalhit/1.1
    Disallow: /

    User-agent: facebookexternalhit
    Disallow: /

    User-agent: SemrushBot
    Disallow: /

    User-agent: crawl
    Disallow: /

    User-agent: feed
    Disallow: /
    ————————————-
    2. .htacess file
    ————————————-
    # MY BOTS WHICH ARE CONSUMING BANDWIDTH BLOCK PRITPAL SINGH #
    RewriteCond %{HTTP_USER_AGENT} ^(.*)facebookexternalhit [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)SemrushBot [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)nbot [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)feed [NC,OR]
    RewriteCond %{HTTP_USER_AGENT} ^(.*)BLEXBot [NC,OR]

    # BLOCK Facebook Crawler
    # https://endurtech.com/block-facebook-crawler-facebookexternalhit/
    RewriteEngine On
    RewriteCond %{HTTP_USER_AGENT} ^facebookexternalhit/1\.1 [NC]
    RewriteRule ^ – [F,L]
    # BLOCK Facebook Crawler END
    ———————————–
    3. In my Server WHM / Cpanel Settings.
    ————————————
    https://www.milesweb.in/hosting-faqs/block-bots-apache-whm-cpanel/
    ———————————-
    4. I added below code in WordPress FUNCTIONS.PHP
    ———————————–
    function block_facebook_user_agent() {
    if (strpos($_SERVER[‘HTTP_USER_AGENT’], ‘facebookexternalhit/1.1’) !== false) {
    wp_die(‘Access Denied’, ‘Error’, array(‘response’ => 403));
    }
    }
    add_action(‘init’, ‘block_facebook_user_agent’);

    if(strstr(strtolower($_SERVER[‘HTTP_USER_AGENT’]), “facebookexternalhit”)){
    exit(0);
    ———————————–
    All my efforts to block/stop such bad bots from my wp website are failed.

    You are requested to provide me some permanent solution to stop/block such bad bot crawlers in my wp website.

    If you need my wp-admin login details, i can share with you. Please confirm.

    Attached is Screenshot: Bots like facebook, semrush consuming all bandwidth.

    Thanks
    Pritpal Singh
    For King IT Solutions.

    Files is visible for topic creator and
    support staff only.
    Avatar: Justin
    Luca Rossi
    Support staff
    July 30, 2024 at 07:17

    Dear @KING IT SOLUTIONS,

    We hope this message finds you well.

    We recommend trying the following plugin for blocking the FacebookBot: [UA Request Throttle WordPress Plugin](https://github.com/Anthony-eng21/UA-Request-Throttle-WordPress-Plugin). We believe it could be beneficial for your current setup.

    Additionally, we suggest reaching out to your hosting provider regarding this matter, as it appears to be related to server-side issues.

    Thank you for your understanding and cooperation.

    Best Regards,
    8Theme’s Team

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

8theme customization service
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.