I simply want that if admin user or front end user try to access login page even after logged in
/admin/login (admin user)
OR
/login (front end user)
then they should be redirected back to their related home page like /admin
or /
The easier solution is to add these two lines to your app/config/security.yml:
always_use_default_target_path & default_target_path, e.g.:
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_provider: form.csrf_provider
login_path: /login
check_path: /login_check
always_use_default_target_path: false
default_target_path: /your/start/path/