【发布时间】:2019-05-01 09:04:16
【问题描述】:
我正在尝试有条件地使用具有多域的路由。
我目前拥有的是:
admin_routes:
host: "admin.{domain}"
resource: "@AppBundle/Controller/Admin"
type: annotation
requirements:
domain: domain.local|domain2.local
defaults: { domain: domain.local }
user_routes:
host: "user.{domain}"
resource: "@AppBundle/Controller/User"
type: annotation
requirements:
domain: domain3.local|domain4.local
defaults: { domain: domain3.local }
两个文件夹中的控制器具有相同的路由名称,因为这是构建应用程序的方式。 由于应用程序仍在加载两条路线,因此上述方法不起作用。对于来自管理员的用户域 url 被构建。 我正在努力实现的目标是完全可能的,还是我完全以这种错误的方式做事?
最终我想要的是一组控制器仅对给定的主机名“可见”。
【问题讨论】:
标签: php symfony symfony-3.4