How to redirect logged in users accessing /user/login to specific page? This is a very specific case.

When a user is already logged in, and then tries to visit the login page, /user/login, they are redirected to their user page, /user.

This is a problem for me and I need them redirected elsewhere. To be clear, I'm not asking the much-asked question "how to redirect users after login". I'm already using r3042login and login destination.

The case explained

My site runs http and https for authenticated users. What's happening is that the user access the http site, then clicks login, logs in on https. Then the user presses Back, or a bookmark to the http site and they are not logged in (because they have a different session). So then they hit log-in, which redirects to the https site, which thinks "ah, you're already logged in!", and presents the user page. The user page is not of any interest to my users.

Ideally I'd have it such that once the https session was started, any access to the http site bounced them over to https again, until they logged out.
Ideally I'd have it such that once the https session was started, any access to the http site bounced them over to https again, until they logged out.


Maybe it can be done on web server side, but I'm not sure.


  How to redirect logged in users accessing /user/login to specific page?


Don't forget you can alter any drupal_goto() calls:

/**
 * Implements hook_drupal_goto_alter().
 */
function YOURMODULE_drupal_goto_alter(&amp;$path, &amp;$options, &amp;$http_response_code) {
  global $user;

  if (current_path() == 'user/login' &amp;&amp; $path == 'user' &amp;&amp; user_is_logged_in()) {
    // Redirect to front page.
    $path = '';
    drupal_set_message(t('Welcome back, %username!', array('%username' =&gt; $user-&gt;name)));
  }
}