Redirect reset Multisite to primary site

Hi All,

I use RainLab.User plugin for user authentication, also I use built-in Multisite site-picker to create a multilingual frontend.
I have a site picker on registration and login page as well but I just realized that if I select any non-primary site then after successfully login/registration the Account component redirects me to the primary site.

The same happens if I press the Logout button:

<a data-request="onLogout" data-request-data="redirect: '/login'" class="dropdown-item">Logout</a>

It redirects me to the login page but set back (reset) the site to the primary one.

Is it possible to avoid such situation and force the system to remember the originally used site in case of redirect as well?

Thank you very much for your help!
Ps: I wish you all a happy new year! :slight_smile:

Hi @vimre,

Happy new year! You could try this…

<a
   data-request="onLogout"
   data-request-data="redirect: '{{ this.site.route_prefix }}/login'"
   class="dropdown-item">Logout</a>

Hi @daftspunky,

Yeah, I have added route_prefix to all my redirects and it work fine, thanks, but I was just thinking about the concept of sites feature of OctoberCMS. Don’t you think that the system should add selected site automatically to the URL in case of redirects as well like it does in case of links as well?

Just an idea…and I definitely do not see the whole picture so maybe I am wrong. :slight_smile:

Best regards,
vimre