I have provided a pre build project on symfony in which the logout session redirects to the login screen, but now i want that page to redirect on the home page instead. What i have found in the coding files is this:
in the base twig file:
<a href="{{path('log_out')}}"><i class="icon-key"></i> Log Out</a>
in routing.yml
#Route for logout page.
log_out:
pattern: /bid/logout
Do anyone know how to change this redirection please hep me out, i am a total newbie to symfony Thanks
Normally it is redirect to home. Check your security.yml config file.
firewalls:
default:
logout:
path: /logout
target: / #This is home url
The easiest way, to my humble opinion, is to simply do a redirection in your logoutAction (so in your controller), like this :
public function myLogoutAction()
{
// Your logout logic
return $this->redirect($this->generateUrl('my_route'));
}
On Symfony 4, by default, the logout action redirects to the / path. You can change the default behavior by setting the proper configuration parameter in the security.yml config file.
security:
...
firewalls:
...
main:
...
logout:
...
target: app_login # you can specify a hard coded URL path or a route name
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.