Open picks44 opened 8 years ago
Up ?
Same issue here. Do you have any clue ?
The issue seems to be from route priority :
en__RG__catch_all ANY ANY www.site.fr /{catchall}
fr__RG__catch_all ANY ANY www.site.fr /fr/{catchall}
I exclude /fr/ from beeing catched, so the second route can intercepte with the correct locale.
# Catch All
catch_all:
path: /{catchall}
defaults:
_controller: MyFrontBundle:Default:catchAll
requirements:
catchall: "^(?!fr/).+$"
My config.yml :
jms_i18n_routing:
default_locale: %locale%
locales:
- en
- fr
strategy: prefix_except_default
I recommend putting the default locale as the last item to the jms_i18n_routing.locales
. This changes the order of the generated routes. (Remember to clear the cache even if you are in dev env.)
E.g:
jms_i18n_routing:
default_locale: en
locales: [tr, en]
strategy: prefix_except_default
its been a long time, but i encountered this same problem and i can confirm what @taylankasap said is working. Just put the default locale at the end.
thanks !
Hello,
I have one route which is configured like this
@Route("/{slug}", name="index_pages", requirements={"slug"=".+"})
I'm using Jmsi18nRouting with the
prefix_except_default
strategy and it's working fine everywhere, except for this routing : in the default (english) locale, the page is found (when the{slug}
iscontact
for instance, likemysite.com/contact
).But on other languages, I have a 404 errors, page not found, because the
{slug}
is sent aslocale/contact
(I can't find the right page with this slug obiously), likemysite.com/sv_SE/contact
.What can I do to "bypass" the locale ?