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




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

默认的商品页URL为:/商品标题-p-商品ID.html
$ `# x. z2 q& F% }想要改为:/p-商品ID.html" }( |+ s3 E& |; J4 ?
实现方法:
- s5 x9 e' d) y3 t4 Q% c, n/ W1 S" c/ t) @- |: {5 L- c' Y
seo.url.php文件约404行:: ~* ?+ W, B9 \7 F. ^
$url = $this->make_url($page, $this->get_product_name($p2[1]), $p2[0], $p2[1], ‘.html’, $separator);
( p5 x- }. m' s% ~改为:. U, F3 F) l" [
$url = $this->make_url($page, ”, $p2[0], $p2[1], ‘.html’, $separator);7 i+ `9 `' N, _! A4 B
约107行:) w! o. I8 p2 Z  }
‘products_id’ => ‘-p-’,
  q, y- I6 d: b改为:! ]/ {( u7 N/ |' w
‘products_id’ => ‘p-’,' A$ i$ [* L0 k8 I& p
修改重写规则,打开.htaccess# o/ _1 ~3 M) e& R2 p
找到:
( C0 K. [- h! O, Z3 f; ^! J4 qRewriteRule ^(.*)-p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]
+ E1 Y9 H& t( g: D* Q# {7 j% b改为:
+ o: s' a3 `/ {9 A. l4 }* FRewriteRule ^(.*)p-(.*).html$ index\.php?main_page=product_info&products_id=$2&%{QUERY_STRING} [L]2 Z3 ]% g) ^( |/ t
完成。1 r" c: c/ S+ y
' g9 t' J2 ^/ g6 Q6 \; `; z0 i8 O
参考:http://www.wuzone.com/715.html

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