I was trying to make a Symfony 2 page when accessed through a browser (ex. example.com) it will redirect to the index page of a bundle.
There shouldn't be a example.com/web or anything at all, how can I achieve this?
I was trying to make a Symfony 2 page when accessed through a browser (ex. example.com) it will redirect to the index page of a bundle.
There shouldn't be a example.com/web or anything at all, how can I achieve this?
You can redirect()
to generate an HTTP redirect.
return $this->redirect($this->generateUrl('bundle_index')); // 302 Moved
Or you render immediately without a redirect using forward()
, so the URL wouldn't change.
return $this->forward($this->generateUrl('bundle_index'));