Well, it seems that triple annotation routing for locale + subdomain processing is the only choice at the moment.
Studying the documentation (for example, in this article ) shows that Symfony developers encourage us to do this in a way that is not pleasant for me. However, here is the solution ...
/** * @Method({"GET"}) * @Route( * "/", * name="homepage", * host="{mobile}.{_locale}.{domain}", * defaults={"mobile" = "moblie", "locale" = "%locale%", "domain" = "%domain%"}, * requirements={"mobile" = "mobile|m", "_locale" = "%locale%|de|fr", "domain" = "%domain%"} * ) * @Route( * "/", * name="homepage", * host="{_locale}.{domain}", * defaults={"_locale" = "%locale%", "domain" = "%domain%"}, * requirements={"_locale" = "%locale%|de|fr", "domain" = "%domain%"} * ) * @Route( * "/", * name="homepage_default", * defaults={"_locale" = "%locale%"} * ) */
Note that order is important, starting with subdomains and ending with the default value. Since this looks ugly with the @Route annotation, I decided to rewrite it also in YAML :
homepage_locale_mobile: path: / host: "{mobile}.{_locale}.{domain}" defaults: { mobile: "mobile", _locale: "%locale%", domain: "%domain%" } requirements: mobile: "mobile|m" _locale: "%locale%|de|fr", domain: "%domain%" homepage_locale: path: / host: "{_locale}.{domain}" defaults: { _locale: "%locale%", domain: "%domain%" } requirements: _locale: "%locale%|de|fr", domain: "%domain%" homepage: path: / defaults: { _locale: "%locale%" }
Ordered as well. Maybe someone will come across and use it.