Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect with less than 4 characters are not redirected #120

Open
maximehuran opened this issue Oct 5, 2024 · 1 comment
Open

Redirect with less than 4 characters are not redirected #120

maximehuran opened this issue Oct 5, 2024 · 1 comment

Comments

@maximehuran
Copy link
Contributor

maximehuran commented Oct 5, 2024

Example

Redirect /faq to /en/faq

Will result to a redirect to the homepage because Sylius think faq is a locale

Sylius calls the homepage with default locale in this listener

image

@delyriand
Copy link

One solution is to replace the regular expression of the locale in config/routes/sylius_shop.yaml so that it doesn't correspond to 4 characters. Example:

     requirements:
-        _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$
+        _locale: ^[a-z]{2}(?:_[A-Z]{2})?$

You need to adapt this expression to your project!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants