OpenCart 3多语言的nginx配置

问题描述 投票:1回答:1

我有一个配置

    location / {
        try_files $uri $uri/ @opencart;
        location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|css|js)$ {
            expires     max;
        }

        location ~ [^/]\.php(/|$) {
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            if (!-f $document_root$fastcgi_script_name) {
                return  404;
            }

            fastcgi_pass    127.0.0.1:9002;
            fastcgi_index   index.php;
            include         /etc/nginx/fastcgi_params;
        }
    }

    location @opencart {
        rewrite ^/(.+)$ /index.php?_route_=$1 last;
    }

jpg

location /en {
  rewrite ^/en/([^?]*) /index.php?_route_=$1&lang=en break;
}

location /es {
  rewrite ^/es/([^?]*) /index.php?_route_=$1&lang=es break;
}

把语言作为第一个URL参数,然后把它作为获取参数。&lang=es 到index.php。如何正确地做到这一点?

nginx opencart opencart-3
1个回答
2
投票

目录控制器启动启动启动.php

  1. . 我没有确切的代码,但如果你熟悉php - URL的路由,你可以在这些文件中找到。这里有很好的手册如何在opencart中通过url设置语言?通过查询 "url中的语言代码",从市场上使用一些免费或付费模块。如果您使用的是SEO URL - 每个产品、类别等都有多语言的URL。你不需要使用postfix,所有的URLs都可以是多语言的和唯一的。如果你没有这些功能 - 只需从这里下载,它是免费的。https:/www.opencart.comindex.php?route=marketplaceextensioninfo&extension_id=32788。

  2. enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.