有人就会问,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. 后台记得开启伪静态,并且服务器支持伪静态
(责任编辑:好模板) |