app/config/routing_dev.yml:
people:
resource: "@myPeopleBundle/Resources/config/routing.yml"
prefix: /people
myPeopleBundle/Resources/config/routing.yml:
people_homepage:
pattern: /{name}
defaults: { _controller: myPeopleBundle:Default:index, name: Foo }
people_homepage2:
pattern: /
defaults: { _controller: myPeopleBundle:Default:index, name: Bar }
myPeopleBundle:Controller:DefaultController.php:
...
public function indexAction($name) {
return $this->render('myPeopleBundle:Default:index.html.twig', array('name' => $name));
}
...
myPeopleBundle:Default:index.html.twig:
Hello {{ name }}!
web/app_dev.php/people ->
Hello Foo!web/app_dev.php/people/ ->
Hello Bar!
Why is it different? The people_homepage
route why not match the second (web/app_dev.php/people/
) url?
But if I set the prefix
to /
I get the same output:web/app_dev.php ->
Hello Foo!web/app_dev.php/ ->
Hello Foo!