Block HTTP request based on user agent - browser used
- 08/21/2026 3:45 PM
If you need to block a user agent / bot / browser from your site, you can do so with a .htaccess rewrite -- note this applies to apache web servers and nginx would have its own method.
RewriteEngine OnRewriteCond %{HTTP_USER_AGENT} botName [NC]RewriteRule .* - [F,L]
Change "botName" to part of the user agent shown in access logs.
