您现在的位置是:首页 > cms教程 > Ecshop商城教程Ecshop商城教程

ecshop怎么做SEO优化

含玉2024-12-19Ecshop商城教程已有人查阅

导读一、完全自定义页面titile,完全抛弃Ecshop定义的页面title格式:[产品名称]_[分类名]_[网店名称]-Powered by ECShop

一、完全自定义页面titile,完全抛弃Ecshop定义的页面title格式:[产品名称]_[分类名]_[网店名称]-Powered by ECShop
1、分析:大家都知道,titile,kewords,description在SEO中的基础性和重要性,但是ECshop官方给出的titile实现方 出现很多类似或相同的页面title,另外还有部分页面无法自定义kewords和 description。在此本人给出了完全自定义的方法,其实方法很简单的,只要稍微懂得一点点代码的都会。
2、修改包括:品牌页,商品页,商品分类页,文章页,文章分类页
3、修改涉及的页面: 品牌页(增加title,keywords和description):brand.php、admin\brand.php、 admin\templates\brand_info.htm
商品页(增加title):goods.php、admin\goods.php、 admin\templates\goods_info.htm
商品分类页(增加title):category.php、admin\category.php、 admin\templates\category_info.htm
文章页面(增加title):article.php、admin\article.php、 admin\templates\article_info.htm
文章分类页(增加title):article_cat.php、admin\articlecat.php、 admin\templates\articlecat_info.htm
4、具体修改:现在就拿品牌页的修改来举例:
1) 首先是修改数据库,未安装的在数据库结构文件install\data\structure.sql中改,已安装的手动在安装后的数据库中改,对brand表增加brand_title、brand_keywords和brand_description等字段
2) 接着修改admin\brand.php,这个文件是管理员后台文件
·88行:
$sql = "INSERT INTO ".$ecs->table('brand')."(brand_name, site_url, brand_desc, brand_logo, is_show, sort_order) "."VALUES ('$_POST[brand_name]', '$site_url', '$_POST[brand_desc]', '$img_name', '$is_show', '$_POST[sort_order]')";
$db->query($sql);
改为:
$sql = "INSERT INTO ".$ecs->table('brand')."(brand_name, site_url, brand_desc, brand_title, brand_keywords, brand_description,brand_logo, is_show, sort_order) "."VALUES ('$_POST[brand_name]', '$site_url', '$_POST[brand_desc]', '$_POST[brand_title]', '$_POST[brand_keywords]', '$_POST[brand_description]', '$img_name', '$is_show', '$_POST[sort_order]')";
$db->query($sql);
·113行
admin_priv('brand_manage');
$sql = "SELECT brand_id, brand_name, site_url, brand_logo, brand_desc, brand_logo, is_show, sort_order "."FROM " .$ecs->table('brand'). " WHERE brand_id='$_REQUEST[id]'";
$brand = $db->GetRow($sql);
改为:
admin_priv('brand_manage');
$sql = "SELECT brand_id, brand_name, site_url, brand_logo, brand_desc,brand_title, brand_keywords, brand_description,brand_logo, is_show, sort_order "."FROM " .$ecs->table('brand'). " WHERE brand_id='$_REQUEST[id]'";
$brand = $db->GetRow($sql);
·151行
$img_name = basename($image->upload_image($_FILES['brand_logo'],'brandlogo'));
$param = "brand_name = '$_POST[brand_name]', site_url='$site_url', brand_desc='$_POST[brand_desc]', is_show='$is_show', sort_order='$_POST[sort_order]' ";
改为:
$img_name = basename($image->upload_image($_FILES['brand_logo'],'brandlogo'));
$param = "brand_name = '$_POST[brand_name]', site_url='$site_url', brand_desc='$_POST[brand_desc]',brand_title='$_POST[brand_title]', brand_keywords='$_POST[brand_keywords]', brand_description='$_POST[brand_description]',is_show='$is_show', sort_order='$_POST[sort_order]' ";
3)紧接着修改admin\templates\brand_info.htm
·在第31行插入:
<tr>
<td class="label">页面标题</td>
<td><input type="text" name="brand_title" maxlength="120" value="{$brand.brand_title|escape}" /></td>
</tr>
<tr>
<td class="label">页面关键词</td>
<td><input type="text" name="brand_keywords" maxlength="120" value="{$brand.brand_keywords|escape}" /></td>
</tr>
<tr>
<td class="label">页面描述</td>
<td><textarea name="brand_description" cols="60" rows="4" >{$brand.brand_description}</textarea></td>
</tr>
4) 之后修改brand.php ,这个文件是前台控制文件
·93、94行
$smarty->assign('keywords', htmlspecialchars($brand_info['brand_desc']));
$smarty->assign('description', htmlspecialchars($brand_info['brand_desc']));
改为:
$smarty->assign('page_title', htmlspecialchars($brand_info['brand_title']));
$smarty->assign('keywords', htmlspecialchars($brand_info['brand_keywords']));
$smarty->assign('description', htmlspecialchars($brand_info['brand_description']));
就这样,品牌页的title,keywords和description全部实现了自定义,商品页、商品分类页、文章页、文章分类页都只需要增加title,修改方法与品牌页(brand)完全相同,想怎么改完全由你自己决定。
二、修改余下的页面title格式
1、分析:Ecshop每个页面都包含了商店标题,不利于SE,也不够个性化,前面已将重要的页面修改成有利于SE的,剩下的可以改你自己喜欢的格式,比如:首页格式:商店标题_商店名称;商品名称_分类名称_商店名
2、修改文件includes\lib_main.php
3、具体修改:
·142行
$page_title = $GLOBALS['_CFG']['shop_title'] . ' - ' . 'Powered by ECShop';
改为:
$page_title = $GLOBALS['_CFG']['shop_name'];
·在241行插入:
if ($filename == 'index')
$page_title=$GLOBALS['_CFG']['shop_title'] . '_' . $page_title;
三、404优化,众所周知,404出错处理不当对搜索引擎收录的影响是非常大的,ecshop在这方面做得非常的差,甚至导致了很多的站不被搜索引擎收录。
1、分析:ECSHOP程序文件category.php及goods.php等页面多处存在以下这样的代码:ecs_header("Location: ./\n");exit;以上代码的意思是,如果找不到当前ID下的分类或者商品,则跳转到网站首页。这样子跳转,返回的HTTP代码将会是302,表明此页面信息暂时性转移,这类跳转代码很容易引起搜索引擎封杀,因此我们需要作出404的优化。
2、修改涉及的文件:article.php,article_cat.php,brand.php,category.php,comment.php,goods.php,topic.php
3、修改方法:将以上7个文件中的 ecs_header("Location: ./\n"); 全部改为 ecs_header("HTTP/1.0 404 Not Found"); $smarty->display('404_error.html');
同时在模板文件中加入404_error.html文件

本文标签:

很赞哦! ()

相关源码

  • (PC+WAP)高端餐饮美食小吃加盟网站模板下载pbootcms本模板基于PbootCMS内核开发,为餐饮美食品牌加盟、小吃连锁企业量身打造。通过精致的美食视觉呈现与加盟业务流程展示,帮助餐饮企业建立专业线上门户,实现品牌形象与加盟业务的双重展示。查看源码
  • (自适应)双语网络电子摄像头设备pbootcms网站模板下载核心功能定位:基于PbootCMS开发的双语摄像头企业官网模板,深度适配产品规格书展示、实时监控演示、解决方案呈现等业务场景,支持中英文内容一键切换。查看源码
  • (自适应)物流运输快递仓储货运网站模板免费下载基于PbootCMS内核开发的物流运输行业专用模板,深度适配仓储货运企业的业务展示需求。前端采用响应式布局,自动适配手机端访问,后台数据实时同步更新,帮助企业高效展示运输网络、仓储设施、服务流程等核心业务模块。查看源码
  • (自适应)蓝色厨卫厨房水龙头阀门水槽设备源码下载基于PbootCMS内核开发,深度适配厨卫设备行业特性。通过精准的产品展示模块与水效标识专区设计,有效呈现五金件工艺细节。响应式布局确保从手机到平板都能展示金属质感与水流动态效果。查看源码
  • (PC+WAP)餐饮奶茶美食小吃招商加盟pbootcms模板源码下载为茶饮烘焙、小吃快餐等餐饮品牌打造的招商加盟系统,助力品牌快速拓展市场;双端pc+wap设计呈现加盟政策对比表。支持后台实时更新菜品图片、加盟费用等关键信息。查看源码
  • (响应式自适应)小学初中作文论文文章资讯博客pbootcms模板下载为中小学作文、教育类网站设计,特别适合展示学生作文、教学资源和写作指导等内容。采用响应式技术,确保在不同设备上都能获得良好的阅读体验。查看源码
分享笔记 (共有 篇笔记)
验证码:

本栏推荐