Daily Latest Tech Update

How to block Googlebot in Nginx

  • Share

Sometime you want to block Googlebot to crawl your site. Googlebot user agent only have googlebot/2.1 or “Googlebot/2.1 (+”. Here are a simple snippet to block Googlebot using Nginx server. This block will redirect Googlebot and serve 403 response.

Put it in your location / directive or any location block of your root.

if ($http_user_agent ~ (googlebot) ) {   return 403;}
  • Share

Leave a Reply

Your email address will not be published. Required fields are marked *