ecshop的SEO优化

很多人喜欢使用ECSHOP,因为他SEO方面优化的非常好,速度也很快,不过用久了发现,他在SEO方面有小地方处理的不是太完美,于是ECSHOP开发中心的贾老师亲自上阵,做了一些优化。

1、68ECShop标题优化

如何修改ECShop标题,现在要将网站标题修改一下,达到下面的效果网站首页标题显示的是为ECSHOP管理中心的[商店标题]。而频道页面,显示的是[频道名+商店名称],当然商品页面显示的是[商品名+商店名称]第一步,去掉标题上的Powered by Ecshop字样。在includes/lib_main.php找到lib_main.php文件,去掉下面这段代码。. ‘ – ‘ . ‘Powered by ECShop’ 第二步,打开模板文件夹的goods.dwt文件,找到{$page_title},将它修改为{$goods.goods_style_name}_{$shop_name}第三步,找到includes/lib_main.php第143行。将

$page_title=$GLOBALS[‘_CFG’][‘shop_title’];改为:$page_title=$GLOBALS[‘_CFG’][‘shop_name’];

然后找到241行左右,找到下面这样的代码

if (!empty($str)) { $page_title = $str . ‘_’ . $page_title; $ur_here .= ‘ <code>&gt; ‘ . $str;}

我们需要在这段代码的前面,加入

if ($filename == ‘index’) $page_title=$GLOBALS[‘_CFG’][‘shop_title’];

这段代码即可。好了,这个ECShop标题我们就修改完了,这样比较符合seo。

2、去掉 ecshop head 之间的Generator" content="ECSHOP v2.7.1"ecshop 把Generator放在title前面看着很不爽,决定去掉,保留页脚的底部版权就可以了<meta name="Generator" content="ECSHOP v2.7.1" /> 下面讲一下怎么删除这行代码,让系统不再自动产生。打开 includes/cls_template.php 文件,大概在1087行左右,找到

$source = preg_replace(‘/<head>/i’, "<head>\r\n<meta name=\&;Generator\&; content=\&;" . APPNAME .’ ‘ . VERSION . "\&; />", $source);

将之删除或者注释掉即可。

第四步:ecshop的标题结构是这样的 文章标题_类别二_类别一|网站名,如果你的类别再深一层那就会更长,这样就会造成大量的重复原标记冲淡主题,那么就动手减短一些标题吧,我们只留下最后的一个分类名就好了打开/includes/lib_main.php 文件,然后找到一下代码 /* 循环分类 */ if (!empty($cat_arr))把下面的代码修改一下 if (!empty($cat_arr)) { $page_title1=$page_title; krsort($cat_arr); foreach ($cat_arr AS $val) { $page_title = htmlspecialchars($val[’cat_name’]) . $page_title1; $args = array($key => $val[’cat_id’]); $ur_here .= ’ <code>></code> <a href="’ . build_uri($type, $args, $val[’cat_name’]) . ’">’ . htmlspecialchars($val[’cat_name’]) . ’</a>’; } } }这样就可以大大缩短,,标题的长度,更利于seo

ECSHOP程序文件category.php及goods.php等页面多处存在类似以下这样的代码:  /* 如果分类不存在则返回首页 */  ecs_header("Location: ./\n");  exit;  以上代码的意思是,如果找不到当前ID下的分类或者商品,则跳转到网站首页。这样子跳转,返回的HTTP代码将会是302,表明此页面信息暂时性转移。(这类跳转代码很容易引起搜索引擎封杀,有能力的朋友,可以做301跳到单独的页面。)  修改方法: 最简单的方法是让它返回404错误页面,即把  ecs_header("Location: ./\n");  exit;  改为:  header("HTTP/1.0 404 Not Found");  exit;五、includes\lib_main.php 134行,以下代码 /* 初始化“页面题目”和“当前地位” */ $page_title = $GLOBALS[‘_CFG’][‘shop_title’]; $ur_here = ‘<a href=".">’ . $GLOBALS[‘_LANG’][‘home’] . ‘</a>’; /* 依据文件名分别解决中间的局部 */ if ($filename != ‘index’) { /* 解决有分类的 */ if (in_array($filename, array(‘category’, ‘goods’, ‘article_cat’, ‘article’, ‘brAnd’))) { /* 商品分类或商品 */ if (‘category’ == $filename || ‘goods’ == $filename || ‘brAnd’ == $filename) { if ($cat > 0) { $cat_arr = get_parent_cats($cat); $key = ‘cid’; $type = ‘category’; } else { $cat_arr = array(); } } /* 文章分类或文章 */ elseif (‘article_cat’ == $filename || ‘article’ == $filename) { if ($cat > 0) { $cat_arr = get_article_parent_cats($cat); $key = ‘acid’; $type = ‘article_cat’; } else { $cat_arr = array(); } } /* 循环分类 */ if (!empty($cat_arr)) { krsort($cat_arr); foreach ($cat_arr AS $val) { $page_title = htmlspecialchars($val[‘cat_name’]) . ‘_’ . $page_title; $args = array($key => $val[‘cat_id’]); $ur_here .= ‘ <code>&gt;</code> <a href="’ . build_uri($type, $args, $val[‘cat_name’]) . ‘">’ . htmlspecialchars($val[‘cat_name’]) . ‘</a>’; } } } /* 解决无分类的 */ else { /* 团购 */ if (‘group_buy’ == $filename) { $page_title = $GLOBALS[‘_LANG’][‘group_buy_goods’] . ‘_’ . $page_title; $args = array(‘gbid’ => ‘0’); $ur_here .= ‘ <code>&gt;</code> <a href="group_buy.php">’ . $GLOBALS[‘_LANG’][‘group_buy_goods’] . ‘</a>’; } /* 拍卖 */ elseif (‘auction’ == $filename) { $page_title = $GLOBALS[‘_LANG’][‘auction’] . ‘_’ . $page_title; $args = array(‘auid’ => ‘0’); $ur_here .= ‘ <code>&gt;</code> <a href="auction.php">’ . $GLOBALS[‘_LANG’][‘auction’] . ‘</a>’; } /* 批发 */ elseif (‘wholesale’ == $filename) { $page_title = $GLOBALS[‘_LANG’][‘wholesale’] . ‘_’ . $page_title; $args = array(‘wsid’ => ‘0’); $ur_here .= ‘ <code>&gt;</code> <a href="wholesale.php">’ . $GLOBALS[‘_LANG’][‘wholesale’] . ‘</a>’; } /* 其余的在这里弥补 */ } } 修正为:/* 初始化“页面题目”和“当前地位” */ $page_title = ”; $ur_here = ‘<a href=".">’ . $GLOBALS[‘_LANG’][‘home’] . ‘</a>’; /* 依据文件名分别解决中间的局部 */ if ($filename != ‘index’) { /* 解决有分类的 */ if (in_array($filename, array(‘category’, ‘goods’, ‘article_cat’, ‘article’, ‘brAnd’))) { /* 商品分类或商品 */ if (‘category’ == $filename || ‘goods’ == $filename || ‘brAnd’ == $filename) { if ($cat > 0) { $cat_arr = get_parent_cats($cat); $key = ‘cid’; $type = ‘category’; } else { $cat_arr = array(); } } /* 文章分类或文章 */ elseif (‘article_cat’ == $filename || ‘article’ == $filename) { if ($cat > 0) { $cat_arr = get_article_parent_cats($cat); $key = ‘acid’; $type = ‘article_cat’; } else { $cat_arr = array(); } } /* 循环分类 */ if (!empty($cat_arr)) { krsort($cat_arr); foreach ($cat_arr AS $val) { $page_title = htmlspecialchars($val[‘cat_name’]) . ‘_’ . $page_title; $args = array($key => $val[‘cat_id’]); $ur_here .= ‘ <code>&gt;</code> <a href="’ . build_uri($type, $args, $val[‘cat_name’]) . ‘">’ . htmlspecialchars($val[‘cat_name’]) . ‘</a>’; } } } /* 解决无分类的 */ else { /* 团购 */ if (‘group_buy’ == $filename) { $page_title = $GLOBALS[‘_LANG’][‘group_buy_goods’] . ‘_’ . $page_title; $args = array(‘gbid’ => ‘0’); $ur_here .= ‘ <code>&gt;</code> <a href="group_buy.php">’ . $GLOBALS[‘_LANG’][‘group_buy_goods’] . ‘</a>’; } /* 拍卖 */ elseif (‘auction’ == $filename) { $page_title = $GLOBALS[‘_LANG’][‘auction’] . ‘_’ . $page_title; $args = array(‘auid’ => ‘0’); $ur_here .= ‘ <code>&gt;</code> <a href="auction.php">’ . $GLOBALS[‘_LANG’][‘auction’] . ‘</a>’; } /* 批发 */ elseif (‘wholesale’ == $filename) { $page_title = $GLOBALS[‘_LANG’][‘wholesale’] . ‘_’ . $page_title; $args = array(‘wsid’ => ‘0’); $ur_here .= ‘ <code>&gt;</code> <a href="wholesale.php">’ . $GLOBALS[‘_LANG’][‘wholesale’] . ‘</a>’; } /* 其余的在这里弥补 */ } } else { $page_title = $GLOBALS[‘_CFG’][‘shop_title’]; }

总有看腻的时候,不论何等荣华的身份,

ecshop的SEO优化

相关文章:

你感兴趣的文章:

标签云: