最新消息:伪静态技术大全博客开通啦!再也不为伪静态东奔西走!更多问题可以反映给博主:野狼,QQ1615241386 QQ交流群:112696646

ecshop的伪静态规则万能版(htaccess格式),规则不行的用这个就对了!

伪静态规则实例 野狼 346浏览 0评论

网络是个好东西,很多东西有人分享,但是让人头疼的是,有很多人不负责任的分享一些东西,总是乱七八糟的,反而是帮倒忙。野狼SEO团队经常接到一些朋友的单子,说是要给伪静态弄一下,有几个问题搞不定。有的客户弄了几个星期搞不定,野狼一看原来是少了一条规则!所以,趁着给别人做ecshop伪静态规则的过程,野狼总结出一个比较全面的规则,分享一下,只要是ecshop的htaccess规则,绝对能搞定。

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]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5&page=$6&sort=$7&order=$8 [QSA,L]
RewriteRule ^category-([0-9]+)-b([0-9]+)-min([0-9]+)-max([0-9]+)-attr([^-]*)(.*).html$ category.php?id=$1&brand=$2&price_min=$3&price_max=$4&filter_attr=$5 [QSA,L]
RewriteRule ^category-([0-9]+)-b([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ category.php?id=$1&brand=$2&page=$3&sort=$4&order=$5 [QSA,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-9]+)(.*).html$ goods.php?id=$1 [QSA,L]
RewriteRule ^article_cat-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ article_cat.php?id=$1&page=$2&sort=$3&order=$4 [QSA,L]
RewriteRule ^article_cat-([0-9]+)-([0-9]+)-(.+)(.*).html$ article_cat.php?id=$1&page=$2&keywords=$3 [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]
RewriteRule ^exchange-id([0-9]+)(.*).html$ exchange.php?id=$1&act=view [QSA,L]
RewriteRule ^exchange-([0-9]+)-min([0-9]+)-max([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ exchange.php?cat_id=$1&integral_min=$2&integral_max=$3&page=$4&sort=$5&order=$6 [QSA,L]
RewriteRule ^exchange-([0-9]+)-([0-9]+)-(.+)-([a-zA-Z]+)(.*).html$ exchange.php?cat_id=$1&page=$2&sort=$3&order=$4 [QSA,L]
RewriteRule ^exchange-([0-9]+)-([0-9]+)(.*).html$ exchange.php?cat_id=$1&page=$2 [QSA,L]
RewriteRule ^exchange-([0-9]+)(.*).html$ exchange.php?cat_id=$1 [QSA,L]

当然,如果还不行,你可以考虑一下情况:
(1)你的程序是二次开发得来的,有些链接结构被修改过了,需要自定义伪静态规则
(2)你服务器是否支持htaccess的伪静态规则
(3)未知疑难杂症……
如果您觉得这个规则仍有问题,可以告诉博主,或者到我们的讨论群里,共同完善最

发表评论
请遵守网络文明公约,理性发言
访客头像

还没有人来评论,快来抢个沙发吧!