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
To redirect the users after log out, you can simply use the User Registration shortcode. By adding the Log out parameter to it, you can easily redirect the user to any desired page on your site.
Adding a logout link to a navigation menu 3. Expand the Custom Links section and add the logout URL in the URL field, making sure to change example.com to your domain name and change the path to your WordPress installation folder, if necessary.
Go to Tools > Redirection and scroll down to the Add new redirection section. In the Source URL field, type or paste in the URL you want to redirect from. In the Target URL field, type or paste in the URL you want to redirect to.
Normally it is redirect to home. Check your security.yml config file.
firewalls:
default:
logout:
path: /logout
target: / #This is home url
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
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