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




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

默认的商品页URL为:/商品标题-p-商品ID.html
# {3 b, W( p8 D" g8 F  O% p想要改为:/p-商品ID.html
* k) Q7 X3 h3 i0 B实现方法:  C- d1 q' V$ a; K  _; ]

6 k' s2 _7 V4 |seo.url.php文件约404行:: }5 t0 r" a  m3 e8 r
$url = $this->make_url($page, $this->get_product_name($p2[1]), $p2[0], $p2[1], ‘.html’, $separator);
- H; ?; B2 @* ~( I改为:& l# Q$ a0 E3 B. U4 L
$url = $this->make_url($page, ”, $p2[0], $p2[1], ‘.html’, $separator);
! f! @! x/ Y+ O7 ^) {3 s$ u! K约107行:
, {! f; Q7 u+ Z" R‘products_id’ => ‘-p-’,
' j+ v% c2 F& d8 x" |2 Q改为:5 @" {8 O5 V2 w5 p9 J. G
‘products_id’ => ‘p-’,% v4 |: o" \, E- r. ~/ |% O' a
修改重写规则,打开.htaccess$ O3 S6 q: T3 f  y* n2 d6 X$ y5 H- L
找到:
$ H7 W/ T. R$ T4 R+ G! VRewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]* B' T0 m8 k+ N1 s. A3 d, ^, w9 P
改为:6 ~; F1 i" I2 j, b+ M
RewriteRule ^(.*)p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
9 s& }- }# E% W; O$ q) Q2 T4 \' ]9 q完成。2 t9 O, z8 H2 r2 a' R

$ Z4 ^5 y. |5 ]% [参考: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
互联网安全