正确robots写法,解决百度搜索不显示缩略图问题

来自:选择信息来源
时间:2019-07-11
阅读:

网站上线http://zhimo.yuanzhumuban.cc/有一年左右时间了,百度搜索显示略缩图少之又少,通过自己这几天的观察发现。

结合百度站长平台的 robots 工具和抓取诊断工具检查后,发现果然是 robots 误禁封造成的! 百度索引变动一直以慢著称,所以 robots 写错了也不会在十天半个月突显出来,真是坑的一 B! 通过抓取诊断工具,发现普通图片可以抓取,带参数的图片就抓取失败。经过多次测试,发现问题出现在 Allow: /*.png$ 这种写法,是以 png 结尾,尾部不再包含其他任何字符,因此,上文提到的 PHP+Nginx 缩略图形式 x.png?w=480

附上个人配置的robots,仅供参考:

# Robots
User-agent: BAIduspider
Allow: /*.png$
Allow: /*.jpg$
Allow: /*.jpeg$
Allow: /*.gif$
Allow: /*.bmp$
Allow: /*.bmp$
Allow: /skin/pengcheng1688/*
Disallow: /api/
Disallow: /install/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
Sitemap: http://zhimo.yuanzhumuban.cc/sitemaps.xml
Sitemap: http://zhimo.yuanzhumuban.cc/hotkey/
Sitemap: http://zhimo.yuanzhumuban.cc/feed/rss.php?mid=5
Sitemap: http://zhimo.yuanzhumuban.cc/feed/rss.php?mid=12
Sitemap: http://zhimo.yuanzhumuban.cc/feed/rss.php?mid=21
 
User-agent: Baiduspider-image
Allow: /*.png$
Allow: /*.jpg$
Allow: /*.jpeg$
Allow: /*.gif$
Allow: /*.bmp$
Allow: /*.bmp$
Allow: /skin/pengcheng1688/*
Disallow: /api/*
 
 
User-agent: Googlebot
Sitemap: http://zhimo.yuanzhumuban.cc/sitemaps.xml
Sitemap: http://zhimo.yuanzhumuban.cc/hotkey/
Sitemap: http://zhimo.yuanzhumuban.cc/feed/rss.php?mid=5
Sitemap: http://zhimo.yuanzhumuban.cc/feed/rss.php?mid=12
Sitemap: http://zhimo.yuanzhumuban.cc/feed/rss.php?mid=21
Disallow: /api/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
 
 
User-agent: googlebot-image
Allow: /*.png$
Allow: /*.jpg$
Allow: /*.jpeg$
Allow: /*.gif$
Allow: /*.bmp$
Allow: /*.bmp$
Allow: /skin/pengcheng1688/*
Disallow: /api/
Disallow: /member/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
 
User-agent: Sogou web spider
Sitemap: http://zhimo.yuanzhumuban.cc/sitemaps.xml
Disallow: /api/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
 
User-agent: Sogou inst spider
Sitemap: http://zhimo.yuanzhumuban.cc/sitemaps.xml
Disallow: /api/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
 
User-agent: Sogou spider2
Sitemap: http://zhimo.yuanzhumuban.cc/sitemaps.xml
Disallow: /api/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
 
User-agent: Sosospider
Sitemap: http://zhimo.yuanzhumuban.cc/sitemaps.xml
Disallow: /api/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
 
User-agent: yisouspider
Disallow: /api/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
 
User-agent: 360Spider
Sitemap: http://zhimo.yuanzhumuban.cc/sitemaps.xml
Disallow: /api/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
 
User-agent: *
Disallow: /api/
Disallow: /install/
Disallow: /member/
Disallow: /skin/
Disallow: /template/
Disallow: /upgrade/
Disallow: /comment/*
Disallow: /?*
Disallow: /*?*
Disallow: /api/*
返回顶部
顶部