0

I need to configure the replacement of the URL containing the country code (code length is always 2 characters). Example:

https://example.ru/en/ => https://example.ru
https://example.ru/en/info/ => https://example.ru/info/
https://example.ru/en/cart/ => https://example.ru/cart/

I wrote the following regular expression:

(.+)\/(?<a2>\w\w)\/(.+)

and the following rule for Nginx:

location / {
  rewrite ^(.+)\/(?<a2>\w\w)\/(.+)$ $1 last;
}

but i get 404 error. How to fix this error so that the rewrite works correctly?

0 Answers0