I think that both the question and the answer here shouldn't be very complicated.
I have installed and configured the FOSUserBundle to use in a project with Symfony2.
What I need to know is where I tell the Security which page it has to redirect the user when they try to access to a forbidden url.
By default it is /login. But I'd like to change it to a more general /main.
Thanks in advance
It's not done by FOSUserBundle, but the Security system in Symfony2. You need to set the following in security.yml:
firewalls:
main:
form_login:
default_target_path: /path/to/redirect/to
EDIT:
Sorry, misread the question. Change login_path to /admin like so:
firewalls:
main:
form_login:
login_path: /admin
This will redirect you to the /admin page - make sure the path works and isn't protected by the firewall. More info here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With