Search code examples
phpsymfonysymfony-security

How to redirect to home page after logout?


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

Solution

  • Normally it is redirect to home. Check your security.yml config file.

    firewalls:        
        default:            
            logout:
                path:   /logout
                target: / #This is home url