I have a symfony2 web that I am trying to internationalize. I have routes with /en and /es prefix, but I want sf2 to get a default language if there is no language specified in url.
I defined a root route with this parameters:
home:
[...]
prefix: /{_locale}/
defaults: { _locale: en }
requirements:
_locale: en|es
Then, if i go to 'www.web.com/en' or 'www.web.com/es' it redirects correctly, but if I go to 'www.web.com', it doesn't get the default language ('en'). I am getting an error message No route found for "GET /".
Where's the mistake?
Thanks.
You can resolve this problem dublicating the route
In your app/config/routing.yml set 2 different route:
Insert: