Ecshop 要不要做伪静态?Ecshop 伪静态规则总结
ECshop seo优化操作的第一步:Ecshop 要不要做伪静态?
其实这个问题博主也很纠结,我先说一下我的观点:
1、这个问题百度官方早有说明(其他搜索引擎应该也差不多),在百度优化指南里明确指出,动态链接不影响百度收录和排名。但是动态url不可太复杂、参数尽量少、尽量不会包括汉字。如果网站动态链接参数不是太复杂,那么百度是可以轻松识别的,不会出现不能收录的情况,也更不会出现动态链接排名差的情况。 网站动态链接进行伪静态处理是完全没有必要的。
我们看一下ecshop 主要的的动态链接结构
- 商品动态RUL:https://www.sdhoupu.com/goods.php?id=461
- 文章页动态RUL:https://www.sdhoupu.com/article.php?id=547
从上面结构可以看出,ecshop的动态url非常简单明了,依据规则,收录和排名不受影响
2、ecshop 开启伪静态后会出现一系列问题:面包屑导航不显示或者显示错误,某些伪静态规则需要自己写等等, 博主还未遇到的问题,如果你的技术力量比较薄弱,维护一个ECSHOP的商城网站还是比较困难的
我的观点:Ecshop 站点,没有必要做伪静态,一方面Ecshop 站点动态URL结构简单明了,不影响百度收录和排名;另一方面,如果你技术力量比较薄弱,维护起来比较麻烦
但是,如果你真的不放心,可以做伪静态,技术也不复杂,以后遇到问题解决问题即可!
Ecshop 开启伪静态的方法和规则总结:
Ecshop 伪静态配置规则分为三种情况:windows IIS环境下;apache 环境下 和 nginx环境下 伪静态的配置
windows IIS环境下 伪静态规则,复制下面的代码,存为 web.config 放到站点的根目录下面就行了
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="index">
<match url="^index.html" />
<action type="Rewrite" url="index.php" />
</rule>
<rule name="category">
<match url="^(.*/)*category.html" />
<action type="Rewrite" url="{R:1}/category.php" />
</rule>
<rule name="category0">
<match url="^(.*/)*category-([0-9]+).html" />
<action type="Rewrite" url="{R:1}/category.php\?id={R:2}" />
</rule>
<rule name="category1">
<match url="^(.*/)*category-([0-9]+)-([0-9]+)-(\w+).html" />
<action type="Rewrite" url="{R:1}/category.php\?id={R:2}&page={R:3}" />
</rule>
<rule name="brands">
<match url="^(.*/)*brands-([0-9]+).html" />
<action type="Rewrite" url="{R:1}/brands.php\?id={R:2}" />
</rule>
<rule name="article">
<match url="^(.*/)*article-([0-9]+).html" />
<action type="Rewrite" url="{R:1}/article.php\?id={R:2}" />
</rule>
<rule name="article_cat">
<match url="^(.*/)*article_cat-([0-9]+).html" />
<action type="Rewrite" url="{R:1}/article_cat.php\?id={R:2}" />
</rule>
<rule name="article_cat_page">
<match url="^(.*/)*article_cat-([0-9]+)-([0-9]+).html" />
<action type="Rewrite" url="{R:1}/article_cat.php\?id={R:2}&page={R:3}" />
</rule>
<rule name="goods">
<match url="^(.*/)*goods-([0-9]+).html" />
<action type="Rewrite" url="{R:1}/goods.php\?id={R:2}" />
</rule>
<rule name="contact">
<match url="^(.*/)*contact.html" />
<action type="Rewrite" url="{R:1}/contact.php" />
</rule>
<rule name="search">
<match url="^(.*/)*search-([a-zA-Z]+).html" />
<action type="Rewrite" url="{R:1}/search.php\?intro={R:2}" />
</rule>
<rule name="maps">
<match url="^(.*/)*maps.html" />
<action type="Rewrite" url="{R:1}/maps.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
apache下的伪静态规则范例
复制下面这段代码,然后存为 .htaccess 放到站点的根目录下面就行了
<FilesMatch "\.(bak|inc|lib|sh|tpl|lbi|dwt)$">
order deny,allow
deny from all
</FilesMatch>
RewriteEngine On
RewriteBase /
# direct one-word access
RewriteRule ^index\.html$ index\.php [L]
RewriteRule ^category$ index\.php [L]
# access any object by its numeric identifier
RewriteRule ^feed-c([0-9]+)\.xml$ feed\.php\?cat=$1 [L]
RewriteRule ^feed-b([0-9]+)\.xml$ feed\.php\?brand=$1 [L]
RewriteRule ^feed-type([^-]+)\.xml$ feed\.php\?type=$1 [L]
RewriteRule ^feed\.xml$ feed\.php [L]
RewriteRule ^category-([0-9]+)-b([0-9]+)-([0-9]+)(.*)\.html$ category\.php\?id=$1&brand=$2&page=$3 [QSA,L]
RewriteRule ^category-([0-9]+)-b([0-9]+)(.*)\.html$ category\.php\?id=$1&brand=$2 [QSA,L]
RewriteRule ^category-([0-9]+)(.*)\.html$ category\.php\?id=$1 [QSA,L]
RewriteRule ^goods-([0-9a-zA-Z_]+)-([0-9]+)(.*)\.html$ goods\.php\?id=$2 [QSA,L]
RewriteRule ^goods-([0-9]+)(.*)\.html$ goods\.php\?id=$1 [QSA,L]
RewriteRule ^article_cat-([0-9]+)-([0-9]+)(.*)\.html$ article_cat\.php\?id=$1&page=$2 [QSA,L]
RewriteRule ^article_cat-([0-9]+)(.*)\.html$ article_cat\.php\?id=$1 [QSA,L]
RewriteRule ^article-([0-9]+)(.*)\.html$ article\.php\?id=$1 [QSA,L]
RewriteRule ^brand-([0-9]+)-c([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)\.html brand\.php\?id=$1&cat=$2&page=$3&sort=$4&order=$5 [QSA,L]
RewriteRule ^brand-([0-9]+)-c([0-9]+)-([0-9]+)(.*)\.html brand\.php\?id=$1&cat=$2&page=$3 [QSA,L]
RewriteRule ^brand-([0-9]+)-c([0-9]+)(.*)\.html brand\.php\?id=$1&cat=$2 [QSA,L]
RewriteRule ^brand-([0-9]+)(.*)\.html brand\.php\?id=$1 [QSA,L]
RewriteRule ^tag-(.*)\.html search\.php\?keywords=$1 [QSA,L]
RewriteRule ^snatch-([0-9]+)\.html$ snatch\.php\?id=$1 [QSA,L]
RewriteRule ^group_buy-([0-9]+)\.html$ group_buy\.php\?act=view&id=$1 [QSA,L]
RewriteRule ^auction-([0-9]+)\.html$ auction\.php\?act=view&id=$1 [QSA,L]
ecshop部署nginx配置伪静态规则方法,
建议用宝塔linux+nginx面板配置(注意,千万别用window+nginx组合,非常不稳定,网站每隔几个小时卡顿,打不开)
当然你也可以单独配置
打开nginx配置文件
比如/usr/local里面的nginx下 conf目录
如果不会查找就在SSH命令里面输入 find / -name "nginx.conf" 目录
这里需要注意的是有些服务器技术员会把配置文件加载到conf.d文件夹里,也就是default.conf文件,
include ecshop.conf;

然后把伪静态规则文件上传和nginx.conf一个目录,附件里是伪静态规则,
然后重启nginx服务:
在SSH输入 service nginx restart
有很多伪静态规则文章中没有提到,大家可以根据实际情况,参照以上规则继续写,比如 帮助页面伪静态规则,专题页面伪静态规则,搜索页面伪静态规则,博主给与以下案例供你们参考
ecshop搜索结果页面伪静态规则
RewriteRule ^search.html$ search.php [L]
#RewriteRule ^search-(.*)-([0-9]+).html search.php?keywords=$1&page=$2 [QSA,L]
RewriteRule ^search-(.*).html search.php?keywords=$1&page=$2 [QSA,L]
效果如下:
搜索首页面:http://****.com/search.html
搜索结果页面:http://****.com/search-关键词.html
ecshop专题伪静态化的规则方法
IIS规则:
RewriteRule ^(.*)/topic-([0-9]+)\.html$ $1/topic\.php\?topic_id=$2
Apache规则:
RewriteRule ^topic-([0-9]+)\.html$ topic\.php\?topic_id=$1 [QSA,L]
为了避免重复收录动态的页面,建议robots里加上
Disallow: /topic.php?
好了,今天就分享到这,有问题大家底下留言把!