-2

Is there a way to redirect users to the front page after they log in, without using any additional modules other than the core modules. Right now they are redirected to their profiles.

  • 1
    Without using any module? What does that mean? How would you think this would work then? Are you asking for code to write your own module? What do you have so far? Where exactly are you stuck? – leymannx May 3 at 18:36
  • I meant without any additional modules other than the core modules – Diana May 3 at 20:06
6

I don't believe it's possible to configure this in core, but there is a fairly well established and lightweight module that can do this for you - redirect_after_login - https://www.drupal.org/project/redirect_after_login

  • Yeah, or drupal.org/project/login_redirect_to_front. But OP asks to achieve this without using any module, whatever that means. – leymannx May 3 at 18:37
  • 1
    Hey leymannx, thanks for your input. I understand that’s what the OP wants, but it’s currently not possible without a module. So that’s the answer. :) – Tyler Fahey May 4 at 19:11
6

The query parameter destination can be used to redirect any form submission, including the login form. Config your web server/Drupal to always add the query parameter such that http://example.com/user/login?destination=/ is the only URL to login. Upon login submission, users will be redirected to http://example.com/.

  • how would you do this configuration? – Diana May 3 at 20:06
  • 1
    For example: setting up redirect rules in Apache/Nginx. – Shawn Conn May 3 at 20:53
  • Yes, this is the only solution that doesn't require any module at all. – kiamlaluno May 10 at 20:02
  • The only "issue" I can see is for sites using the login block, but the answer clearly suggests to make login possible only from a page (which means not to use the login block, but eventually a login link shown on any page). – kiamlaluno May 10 at 20:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.