Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 727
Geetika Avatar asked May 27 '15 07:05

Geetika


People also ask

How do I redirect a page after logging out?

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.

How do I change my WordPress logout URL?

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.

How do I redirect my WordPress homepage?

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.


2 Answers

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

firewalls:        
    default:            
        logout:
            path:   /logout
            target: / #This is home url
like image 119
Dinuka Thilanga Avatar answered Sep 20 '22 08:09

Dinuka Thilanga


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
like image 44
Dayron Gallardo Avatar answered Sep 20 '22 08:09

Dayron Gallardo