This is the how to for redirection implementation by roles after login or logout in Symfony2
- Copy
AfterLoginRedirection.php
andAfterLogoutRedirection.php
to your bundle under the "Redirection" directory - Edit your
services.yml
file in your bundle and copy/paste the content ofservices.yml
- Edit your
security.yml
file... - ... add
success_handler: redirect.after.login
inform_login:
section - ... add
success_handler: redirect.after.logout
inlogout:
section