Forum Moderators: phranque
RewriteCond %{HTTP_USER_AGENT} googlebot|yahoobot|microsoftbot [NC]
RewriteRule ^.*$ – [R=403,L]
RedirectMatch 301 ^(.*)$ http://www.example.com/ [edited by: phranque at 1:54 am (utc) on Dec 25, 2016]
[edit reason] [url=http://www.webmasterworld.com/apache/4452736.htm]IMPORTANT: Please Use [b]exampl [/edit]
when there are Redirect(Match) and RewriteRule directives in the same scope, the RewriteRule directives will run first, regardless of the order of appearance in the configuration file
Block googlebot from seeing the redirect(sounds dumb but I have a good reason)
Just wish there was a way to know for sure if Googlebot was being blocked.There is. Just look in your logs and verify that Googlebot requests for the relevant pages get a 403 response rather than 301.
RewriteCond %{HTTP_USER_AGENT} googlebot [NC]This is the textbook case of when not to use the [NC] flag. Learn the correct casing of the robot's name (also, as noted upthread, its correct name), and use it.
66.249.75.100 - - [25/Dec/2016:22:44:50 -0500] "GET / HTTP/1.1" 403 202 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +(google website here))"