ZEN CART URL 重写解析

一个模板 用的次数多了 直接影响SEO, 最好的解决思路是重写URL 地址

在.htaccess文件中找到这段代码:

RewriteRule ^(.*)-c-(.*).html$ index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]

然后在seo.url.php中找到如下代码:

'cPath' => '-c-', 和 $url = $this->make_url($page, $this->get_category_name($p2[1]), $p2[0], $p2[1], '.html', $separator);

A:假如我们想要这种URL(你的网站/栏目名对应的拼音/c/栏目ID/【http://www.zencart110508.com/authentic/c/2/】)上面两处的代码修改如下:

'cPath' => '/c/', 和 $url = $this->make_url($page, $this->get_category_name($p2[1]), $p2[0], $p2[1], '/', $separator);

对应着(.htaccess文件中)

RewriteRule ^(.*)-c-(.*).html$ index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]   修改为
RewriteRule ^(.*)/c/(.*)$ index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]

B: 假如我们想要这种URL(你的网站/栏目名对应的拼音/xxx(自己随便定义,不要是汉字哦)/栏目ID/【http://www.zencart110508.com/authentic-sort-2.html】)上面两处的代码修改如下:

‘cPath’ => ‘-sort-’, 和 $url = $this->make_url($page, $this->get_category_name($p2[1]), $p2[0], $p2[1], ‘.html’, $separator);

对应着(.htaccess文件中)

RewriteRule ^(.*)-sort-(.*)$ index.php?main_page=index&cPath=$2&%{QUERY_STRING} [L]

其它修改都是类似.

 

posted @ 2013-10-29 15:06  月影传说  阅读(520)  评论(0)    收藏  举报