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.
It all looks correct apart from your prefix. Take the trailing slash off because otherwise you routing rule is trying to match www.web.com// meaning you don't actually have a route defined for www.web.com.