$7.49 .com domain with free InstantPage Website Builder$1.99 Web Hosting   捷飞网络官方淘宝店   Godaddy 优惠码
返回列表 发帖
分享到:




[开发经验技巧分享] 修改Zen Cart Ultimate SEO URLs 模块商品页URL重写地址

默认的商品页URL为:/商品标题-p-商品ID.html
# f- N' ^2 `7 G* W想要改为:/p-商品ID.html
8 a  j; E9 ?* y% w1 @% r7 z实现方法:
- ?7 D" Z, F( G1 X8 z8 e8 n5 k. E( L
seo.url.php文件约404行:/ r% D' [$ j- i$ }, `% f
$url = $this->make_url($page, $this->get_product_name($p2[1]), $p2[0], $p2[1], ‘.html’, $separator);
6 k+ O3 F1 u) g6 h改为:( U  Q, g' \% ]
$url = $this->make_url($page, ”, $p2[0], $p2[1], ‘.html’, $separator);
, m9 Z$ x8 y- l0 }0 X7 G" v0 m约107行:  {8 l3 d1 r* }3 h6 [
‘products_id’ => ‘-p-’,% Q7 s/ j' \9 U* ~. [+ G- l/ l* |
改为:
/ b$ v5 u# ]7 U3 P! n3 j) ]+ t‘products_id’ => ‘p-’,8 s. i) [& u7 X' X* m# x
修改重写规则,打开.htaccess
! W. @: U; D4 h. _; z: Q找到:
5 J4 r8 G# I* \+ R' _5 k4 A2 HRewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
9 z* N0 ~( a3 I7 N; |" w4 F' w7 s改为:/ m& E; l/ M, I9 t: {5 {
RewriteRule ^(.*)p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
) X: H8 r" S' p' x# _完成。8 m  u0 V- X7 d. w( k
% v3 w, P2 m2 f8 ]+ v
参考:http://www.wuzone.com/715.html

美国VPS、域名代购:http://tu8l.taobao.com

返回列表
Namecheap
Namecheap.com - Cheap domain name registration, renewal and transfers - Free SSL Certificates - Web Hosting
互联网安全