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


        网站上线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/*
    

      

         

       

  • 相关阅读:
    匹配session
    Jdk1.8+Eclipse+MySql+Tomcat开发Java应用的环境搭建
    MySQL忘记密码怎么办
    MyBatis框架Maven资源
    MyBatis核心配置文件模版
    MyBatis执行过程显示SQL语句的log4j配置
    MyBatis实体类映射文件模板
    Mybatis 学习-4
    Spring Boot + Swagger
    Spring Boot + Swagger
  • 原文地址:https://www.cnblogs.com/68xi/p/9777631.html
Copyright © 2020-2023  润新知