How to redirect according to URL parameter after form submission Currently I'm using Drupal as my authentication system, and I would like to redirect user to our main site after login, according to an URL-passed parameter, for example user/login?redir=http://google.com. And yes I've found out there is a destination parameter however it doesn't work it the passed argument begins with http or somehow a non-Drupal path. Any ideas? hook_drupal_goto_alter is a hook I found might be helpful, but not sure how to implement it.
The issue with ?destination= is that it provides no mechanism for setting external =&gt; TRUE for the options in drupal_goto(), which Drupal needs to redirect to an off-site location.

I think the easiest way to get what you're looking for is to implement hook_form_alter() for the user login form, save the URL parameter if it's available, and then manually redirect in the submit handler.

Something like this:

function MYMODULE_form_user_login_alter(&amp;$form, &amp;$form_state, $form_id) {
  if (isset($_GET['redir'])) {
    $form['redir'] = array(
      '#type' =&gt; 'value',
      '#value' =&gt; $_GET['redir']
    );

    $form['#submit'][] = 'MYMODULE_user_login_redirect';
  }
}

function MYMODULE_user_login_redirect(&amp;$form, &amp;$form_state) {
  $form_state['redirect'] = array($form_state['values']['redir'], array('external' =&gt; TRUE));
}