How to block Googlebot in Nginx

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;}

Originally posted 2019-01-30 00:00:00.

See also  Add Google Adsense to Ghost Blog

About wahyuway

Check Also

How To Deploy Droplet on DigitalOcean With Terraform

Hello good people. In today’s blog post we will be showing you how to create …

Leave a Reply