canonical
discuz加canonical URL标签,规范化网址
Discuz的网址规范化有很多问题,即同样的内容,有着好多不同的URL。下面使用canonical URL TAG新标准来处理这些问题。
一,给viewthread.php页加canonical URL
可以发现这种动态的链接形式最多了,有不同的参数但内容一样,当然现在的SE能够处理这些问题,但但很难判断首选显示URL方式,或者当他们都有返回链接时,不能集中权重。为了解决类似的重复网页问题,googel,yahoo,live,ask.com都宣布支持一个新的标签属性,以把链接和权重都集中到一个首先的URL上。
1.给viewthread.php加canonical URL标签,指定帖子的静态地址为首选版本。
修改viewthread.php文件,在$page = max($page, 1);上面(程序调用包含文件结束),加一行$extrahead .='<link rel=”canonical” href=”thread-‘ .$tid. ‘-1-1.html” />’;
2.给打印页加canonical tag
虽然打印页viewthread.php?action=printable…..也是调过这个程序生成数据,但用了不同的模板,要把变量$extrahead 加进去,修改tmplates\default\viewthread_printable.htm
在<head>部分<title>的下面加一行: $extrahead
二.给forumdisplay.php加canonical tag
在include template(‘forumdisplay’);上加一行:
$extrahead .='<link rel=”canonical” href=”forum-‘ .$fid. ‘-‘ .$page. ‘.html” />’;
三.为archiver页加link canonical标签
1.修改archiver/index.php:在global $boardurl, $_DCACHE, $charset, $navtitle, $headerbanner, $headernav;行下加一行:global $extrahead;
在<meta http-equiv=”Content-Type” content=”text/html; charset={$charset}” />
行下加一行:$extrahead
2.修改archiver\include\thread.inc.php:此文件中有两个showheader();,在第二个的上面加一行:$extrahead .='<link rel=”canonical” href=”thread-‘ .$tid. ‘-1-1.html” />’;
四.将archiver内容页最下的“本看完整版本”链接改为静态形式
修改archiver/include/thread.inc.php,将 “viewthread.php?tid=$tid”替换为”thread-{$tid}-1-1.html”
如果您是以动态URL形式为首先版本,上述相应位置应替换为如下语句:
$extrahead .='<link rel=”canonical” href=”viewthread.php?tid=’ .$tid. ‘” />’;
标签云
.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
