SA
ну и как писали выше - тестирование конфигурации:
nginx -t
Size: a a a
SA
nginx -t
ВМ
if ($request_uri ~* "^/(.*)/(\?.*)?$") { return 301 /$1$is_args$args; }
ВМ
ВМ
ВМ
SA
nginx -t
?SA
ВМ
ВМ
location ~ ^/(.*)/$ { return 301 /$1$is_args$args; }
ВМ
ВМ
MK
location @api {
rewrite ^/(.+)$ /api$1 last;
}
location /api {
set $redir 0;
}
location / {
if ($http_user_agent ~ @api) {
set $redir 1;
}
if ($redir = 1){
rewrite ^(.*)$ /@api/ permanent;
}
}
, но как скомпоновать два редиректа в одном if , ведь первый отработал, а второй за ним пропускается. В nginx ведь нет условий
мне кажется это из-за индекса самого opencart, без него не работает /```index.php?route=
rewrite ^/api/?(.*)$ /index.php?route=api/$1 last;```
}
location / {
try_files $uri @opencart;
}
location @opencart {
rewrite ^/(.+)$ /index.php?_route_=$1 last;
}
ВМ
ВМ
ВМ
ВМ