I tried to select a controller by host.
This is what I did in my routing.yml:
rout_default:
resource: "@DefaultBundle/Controller/"
type: annotation
prefix: /
rout1:
resource: "@DefaultBundle/Controller/Controller1Controller.php"
type: annotation
prefix: /
host: example.com
rout2:
resource: "@DefaultBundle/Controller/Controller2Controller.php"
type: annotation
prefix: /
host: example2.com
In the contollers I have following Actions:
/**
* @Route("/data", name="data")
*/
public function dataAction()
{
//...
}
I have these functions in both controllers. I know that the action and the name is the same, but I hoped, that the system will notice the difference by the host.
If I type debug:router in the console, there is only the route of rout2. The other one is not visible.
Thank you for your help.