WebDev

Webdevelop => Site Discussion => Topic started by: Dave on September 11, 2026, 05:36:33 AM

Title: Bots again..
Post by: Dave on September 11, 2026, 05:36:33 AM
It seems that recently there has been a resurgence of Facebook bots, as well as others, on the sites. I thought I'd ask Google AI how to solve it and what it came up with was the code below.

Before I added the code there were 263 bots looking at my site, now I know that's not many compared to this site, at the point of writing this post there were 3546 visitors, but what they were doing is causing extra load on the server and giving some members and I '504 bad gateway' errors.

After adding the code to the .htaccess file the numbers gradually dropped significantly.

There was another option for the code which was use the mod_rewrite option but if the host does not have that enabled then the code will not work but using the 'If' option will.

<If "%{HTTP_USER_AGENT} =~ /(FacebookBot|meta-externalagent|Meta-ExternalFetcher|facebookexternalhit|Amazonbot|Bingbot|AdIdxBot|BingPreview|MicrosoftPreview|ClaudeBot|GPTBot|ChatGPT-User)/i">
    Require all denied
</If>

I have posted this on SMFH also
EhPortal 1.40.4-RC15 © 2026, WebDev