Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Dec 312010

Block request by user agent in Apache


If you want to block request to your web site, by user agent string, you can change by editing the Apache's configuration.

Add the following lines to the Apache configuration (httpd.conf)

RewriteCond %{HTTP_USER_AGENT} googlebot
RewriteRule . - [F,L]

The above config block all requests from Google's Bot. (Make sure mod_rewrite is installed and enabled)

Also, remember to restart Apache to take effect

# apachectl -k graceful

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>