Reputation: 4730
Right now my homepage is the DefaultController
:
/**
* @Route("/", name="homepage")
*/
public function indexAction(Request $request)
{
But I'd like the default to be in my blog controller:
/**
* @Route("/blog/index", name="blog_index")
*/
public function indexAction() {
I realise I could just set this route to /
, but what I'd like is for both /blog/index
and /
to route to the same action (displaying the /blog/index
url if possible).
I've had a look for previous answers, but I can't find one that deals specifically with annotations.
Right now I'm just redirecting from the DefaultController
but that feels slightly hacky - does anyone have a better solution?
Upvotes: 0
Views: 1686
Reputation: 411
Have you tried the following in your blog controller?
/**
* @Route("/", name="homepage")
* @Route("/blog/index", name="blog_index")
*/
public function indexAction() { ... }
Upvotes: 6