服务报价 | 域名主机 | 网络营销 | 软件工具| [加入收藏]
 热线电话: #
当前位置: 主页 > php教程 > OpenCart教程 >

OpenCart2.0完全伪静态教程

时间:2016-02-10 20:30来源:未知 作者:最模板 点击:
有人就会问,OpenCart2.0完全伪静态,如何改?要改哪些文件呢?其实挺简单的,我在这里给大家介绍下 1. 修改opencart的源文件文件 文件地址catalog\controller\common\seo_url.php (,这个文件是

有人就会问,OpenCart2.0完全伪静态,如何改?要改哪些文件呢?其实挺简单的,我在这里给大家介绍下

1. 修改opencart的源文件文件

文件地址 catalog\controller\common\seo_url.php (,这个文件是控制网站全部的伪静态的读和写。要修改的地方是在107行(本次修改只适合2.0版本以上),添加代码

else {
     $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($data['route']) . "'");
 
    if ($query->num_rows) {
        $url .= '/' . $query->row['keyword'];
 
        unset($data[$key]);
     }
 }

2. 给opencart数据库插入数据

INSERT INTO oc_url_alias (query, keyword) VALUES (‘common/home’, ”);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/wishlist’, ‘wishlist.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/account’, ‘my-account.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘checkout/cart’, ‘shopping-cart.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘checkout/checkout’, ‘checkout.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/login’, ‘login.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/logout’, ‘logout.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/order’, ‘order-history.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/newsletter’, ‘newsletter.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘product/special’, ‘specials.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/account’, ‘affiliates.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘checkout/voucher’, ‘gift-vouchers.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘product/manufacturer’, ‘brands.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘information/contact’, ‘contact.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/return/insert’, ‘request-return.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘information/sitemap’, ‘sitemap.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/forgotten’, ‘forgot-password.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/download’, ‘downloads.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/return’, ‘returns.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/transaction’, ‘transactions.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/register’, ‘register.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘product/compare’, ‘compare-products.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘product/search’, ‘search.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/edit’, ‘edit-account.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/password’, ‘change-password.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/address’, ‘address-book.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘account/reward’, ‘reward-points.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/edit’, ‘edit-affiliate-account.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/password’, ‘change-affiliate-password.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/payment’, ‘affiliate-payment-options.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/tracking’, ‘affiliate-tracking-code.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/transaction’, ‘affiliate-transactions.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/logout’, ‘affiliate-logout.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/forgotten’, ‘affiliate-forgot-password.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/register’, ‘create-affiliate-account.html’);
INSERT INTO oc_url_alias (query, keyword) VALUES (‘affiliate/login’, ‘affiliate-login.html’);

3. 后台记得开启伪静态,并且服务器支持伪静态

(责任编辑:最模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
热点内容