
# BEGIN BLJ Bot Gate
# The directives (lines) between "BEGIN BLJ Bot Gate" and "END BLJ Bot Gate" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On

# 1. robots.txt + sitemaps: approved crawlers only, everyone else 403.
RewriteCond %{REQUEST_URI} (^/robots\.txt$|sitemap[^/]*\.xml(\.gz)?$|wp-sitemap[^/]*\.xml$) [NC]
RewriteCond %{HTTP_USER_AGENT} !(Googlebot|Googlebot-Image|Googlebot-News|Google-InspectionTool|GoogleOther|Storebot-Google|APIs-Google|Mediapartners-Google|AdsBot-Google|AhrefsBot|AhrefsSiteAudit|SemrushBot|SemrushBot-SA|SiteAuditBot|SplitSignalBot|rogerbot|dotbot) [NC]
RewriteRule .* - [F,L]

# 2. Known scrapers, SEO-spy crawlers and headless test agents: blocked site-wide.
RewriteCond %{HTTP_USER_AGENT} (MJ12bot|BLEXBot|DataForSeoBot|PetalBot|SeznamBot|Barkrowler|ZoominfoBot|SerpstatBot|linkfluence|MegaIndex|Sogou|YisouSpider|BUbiNG|CCBot|Screaming Frog|SiteBulb|Sitebulb|Xenu|NetcraftSurveyAgent|python-requests|python-urllib|Scrapy|Go-http-client|Java/|okhttp|libwww-perl|curl/|Wget|HTTrack|PhantomJS|HeadlessChrome|Puppeteer|Playwright|masscan|zgrab|Nmap|nikto|sqlmap) [NC]
RewriteRule .* - [F,L]

# 3. A request with no User-Agent at all is never a real visitor.
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteCond %{REQUEST_URI} (^/robots\.txt$|sitemap[^/]*\.xml(\.gz)?$) [NC]
RewriteRule .* - [F,L]
</IfModule>
# END BLJ Bot Gate