追影 发表于 2022-12-1 16:53:44

damishop伪静态自定义路由的使用

(1) 开启伪静态规则: nginx如下
            location / {
                # This try_files directive is used to enable SEO-friendly URLs for OpenCart
                try_files $uri $uri/ @opencart;
                # 隐藏index.php
                if (!-e $request_filename) {
                  rewrite^/(.*)$ /index.php?$1 last;
                }
            }
            
            location @opencart {
                rewrite ^/(.+)$ /index.php?_route_=$1 last;
            }


(2) 自定义伪静态列表文件 位置:
catalog/routes.php
支持多参数:'/product/{path}/{product_id}.html'=>'product/product/index',
控制器将接受 GET参数path与product_id用户访问的举例:/product/5-35/1625.html


页: [1]
查看完整版本: damishop伪静态自定义路由的使用