Prevent BaiduSpider from crawling your site

Method 1: User-agent block

// Nginx conf

if ($http_user_agent ~* ^Baiduspider) {
  return 403;
}

Method 2: robots.txt

User-agent: Baiduspider
Disallow: /
User-agent: Baiduspider-video
Disallow: /
User-agent: Baiduspider-image
Disallow: /

Method 3: Block IP

# Baidu crawlers
deny 123.125.71.0/24;
deny 180.76.5.0/24;
deny 180.76.15.0/24;
deny 220.181.108.0/24;

Method 4: .htaccess

order allow,deny 
allow from all
# Block access to Baiduspider 
deny from 180.76.5.0/24 180.76.6.0/24 123.125.71.0/24 220.181.108.0/24 

Photo by Nicolas Picard on Unsplash