discuz论坛禁止无效页面的收录
discuz会产生哪些无效的页面,有什么问题
1.删除了的帖子、版块,当访问时返回帖子不存在的提示信息页。
2.设置了一定权限才能浏览的帖子、版块,很多情况会泄露链接,得到没权限的提示
3.其它各种情况下的提示信息页面。这些都是给用户看的,没有实质内容,都禁止收录。
其实最大的问题还是副本内容的问题,因这些不同的URL,返回的却是相同的内容。对SE不友好。其实对于删除了内容,应该返回404,但为了简单,都使用加meta robots标签,禁止ES收录的方法来解决。
修改提示信息页面,解决重复内容问题
方法一
1.建立/templates/defualt/header_norobot.htm文件
完全拷贝header.htm的内容,在<title>下再加一行:
<meta name=”robots” content=”noindex,nofollow” />
2.修改/templates/default/showmessage.htm文件
将{subtemplate header}替换为{subtemplate header_norobot}
3.修改/templates/default/nopermission.htm文件
将{subtemplate header}替换为{subtemplate header_norobot}
如此修改之后,SE就不会收录无权访问的URL,对于已删除的帖子,因为禁止收录了,过一段时间也会从索引中删除。这样,给SE的都是一些有内容的网页,对于提高权重会有好处。
方法二
修改global.func.php文件中的showmessage函数。
function showmessage($message, $url_forward = '', $extra = '', $forwardtype = 0) { extract($GLOBALS, EXTR_SKIP); global $hookscriptmessage, $extrahead, $discuz_uid, $discuz_action, $debuginfo, $seccode, $seccodestatus, $fid, $tid, $charset, $show_message, $inajax, $_DCACHE, $advlist; define('CACHE_FORBIDDEN', TRUE); $hookscriptmessage = $show_message = $message;$messagehandle = 0;
在第四行 define(‘CACHE_FORBIDDEN’, TRUE); 后面加上:
$extrahead .='';
即是
function showmessage($message, $url_forward = '', $extra = '', $forwardtype = 0) { extract($GLOBALS, EXTR_SKIP); global $hookscriptmessage, $extrahead, $discuz_uid, $discuz_action, $debuginfo, $seccode, $seccodestatus, $fid, $tid, $charset, $show_message, $inajax, $_DCACHE, $advlist; define('CACHE_FORBIDDEN', TRUE); $extrahead .='<meta name="robots" content="noindex,nofollow" />'; $hookscriptmessage = $show_message = $message;$messagehandle = 0;
Leave a Reply
标签云
.htaccess 301 2010 Android apache cache cacti CSS date ddos discuz django fastcgi freebsd git google http iftop linux macos mysql nginx njava php pr python sed seo snmp ssh ubuntu ubuntu10.04 wordpress xdebug 优化 密码 文件 时区 用户 登录 监控 缓存 网站 脚本 颜色
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
近期文章
近期评论
文章归档
链接表
QR Code
