![]() |
|
|||||||
| Discuz/SupeSite/X-Space 讨论Discuz安装、升级、模板、插件、源代码修改以及使用技巧等。 |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
IP: 49.87.137.48
|
|||
|
|||
|
解决重复URL的问题和屏蔽垃圾页面
Discuz! X1.5 还是不可避免的出现重复url的问题。 (希望有渠道的朋友能把这些问题反馈给Discuz相关人员) 这些重复的url即浪费了爬虫大量的时间,又使网站的原创性受到损害。所以一定要屏蔽很多重复页面。 另外还要干掉一些垃圾页面,所谓垃圾页面就是一些没什么SEO价值的页面,也帮助爬虫节约时间。 解决这个问题,最好是用robots.txt文件来解决。因为里面的规则是最强势的,所有爬虫第一次访问一个域名,第一个动作都是下载这个robots.txt文件并读取里面的规则。 其他一些nofollow和rel=canonical等标签适当的时候再用。 虽然Discuz默认写了一些robots规则,但是还是不够理想。 根据从首页的代码中发现的问题,需要在robots.txt里增加的规则有: Disallow: /forum.php$ Disallow: /search-search-adv-yes.html Disallow: /space-username-* Disallow: /forum.php?gid= Disallow: /home.php?mod=space&username= Disallow: /forum.php?showoldetails= Disallow: /home-space-do-friend-view-online-type-member.html Disallow: /space-uid-* 根据在板块帖子列表页面发现的问题,需要在robots.txt里增加的规则有: Disallow: /search.php$ Disallow: /forum-forumdisplay-fid-* 根据在帖子详细信息页面看到的问题,需要在robots.txt里增加的规则有: Disallow: /forum-viewthread-tid-*-extra-page%3D.html$ Disallow: /forum.php?mod=viewthread&tid= Disallow: /forum-viewthread-tid-*-page-*-authorid-*.html Disallow: /forum-viewthread-tid-*-extra-page%3D-ordertype-*.html Disallow: /forum-viewthread-action-printable-tid-*.html Disallow: /home-space-uid-* 至于为什么要写这些规则,由于描述起来实在啰嗦,所以大家自行到源代码里查看为什么。 robots的写法是很灵活的。 可以看一下百度的robots写法指南: http://www.baidu.com/search/robots.html 以及google网站管理员中心的说明: http://www.google.com/support/webmas...&answer=156449 robots.txt写到这里并不是结束,还有两件事情要做。 1,因为robots.txt和nofollow是不同的意思,所以robots.txt并不能代替nofollow。以上这些需要屏蔽的地方还需要用nofollow标注一下。 不过因为要改的源码太多,暂时先不动。需要用nofollow,还有一个原因是某些搜索引擎并不遵守自己所定下的robots规则。 2,因为只看过论坛中的三类主要页面,还有很多页面没查看过,难免会有漏掉的地方,所以需要以后经常到日志中查看爬虫的轨迹,看看爬虫还有哪些抓取问题。 |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|