Symfony2 default locale in routing

If someone is interested in, I succeeded to put a prefix on my routing.yml without using other bundles.

So now, thoses URLs work :

Edit your app/config/routing.yml:

    resource: "@ExExampleBundle/Resources/config/routing.yml"
    prefix:   /{_locale}
        _locale: |fr|en # put a pipe "|" first

Then, in you app/config/parameters.yml, you have to set up a locale

    locale: en

With this, people can access to your website without enter a specific locale.

Leave a Comment