Php 在子域和tld的Symfony路由配置中使用通配符

Php 在子域和tld的Symfony路由配置中使用通配符,php,symfony,routing,annotations,Php,Symfony,Routing,Annotations,我试图设置Symfony路由。我用的是symfony2.7。我有两个bundle在不同的子域下工作。域名可以是通配符,tld可以是多个 这是我当前的配置文件: company_api: resource: "@ApiBundle/Controller/" type: annotation prefix: / company_core: resource: "@CoreBundle/Controller/" type: annotation prefix: / 我希望第

我试图设置Symfony路由。我用的是symfony2.7。我有两个bundle在不同的子域下工作。域名可以是通配符,tld可以是多个

这是我当前的配置文件:

company_api:
resource: "@ApiBundle/Controller/"
type:     annotation
prefix:   /

company_core:
resource: "@CoreBundle/Controller/"
type:     annotation
prefix:   /
我希望第一个bundle只在子域“api”下工作,域可以是通配符,对于TLD,我希望指定一些类似(nl | eu)的代码

已编辑

company_core:
resource: "@ApiBundle/Controller/"
type:     annotation
prefix:   /
host:     www.mydomainname.{tld}
defaults:
    tld: nl
requirements:
    tld: "nl|eu"

我没有升级此设置的配置。tld工作正常。只有域名“mydomainname”才可能有一个通配符?这很容易,因为dev和producten服务器使用不同的doaman名称

下面是我在3.1应用程序上使用的示例,其中我为顶级域使用占位符,该占位符因环境而异-

app:
    resource: "@AppBundle/Controller/"
    type: annotation
    host: www.example.{tld}
    defaults:
        tld: "%tld%"
    requirements:
        tld: "%tld%"
我不明白为什么以下内容不适用于您的API路由,因为根据以下要求,这些内容都应与2.7兼容:


我确实记得,在开发过程中,路由配置似乎被积极缓存,因此,一如既往,在进行任何路由更改后,请确保清除缓存。

能否提供一个或两个您尝试过但不起作用的配置示例?感谢这一点,只有它始终将请求重定向到默认域和tld。我希望它保留请求的域和tld,但只支持我在需求中指定的多个域和tld?
company_api:
    resource: "@ApiBundle/Controller/"
    type: annotation
    host: api.{domain}.{tld}
    defaults:
        domain: yourdefaultdomain
        tld: nl
    requirements:
        tld: "nl|eu"