Block HTTP request based on user agent - browser used

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 On
RewriteCond %{HTTP_USER_AGENT} botName [NC]
RewriteRule .* - [F,L]

 

Change "botName" to part of the user agent shown in access logs. 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

Frontpage Publishing via FTP

Frontpage extensions are not supported on our servers due to bugs in the extensions (some...

Force WWW or non-WWW

NONE SSLTo force www in your URLs, place the following in the .htaccess.RewriteCond %{HTTP_HOST}...

Aliasing Domains with Proper SEO (domains and Search Engines)

Aliasing a domain to a primary domain is a great way to simplify domain hosting as only one main...

Wordpress on Windows IIS7

When installing wordpress on windows servers with IIS7, it is important to use the following...

Your own php error.log and displaying errors

Is your script not behaving as expected or producing a white page?   If so, it could be a PHP...