If you try to access a Drupal page without proper permission, you will be redirected to default 403 access denied page. But if you have enabled the Redirect 403 to User Login module, you will be redirected to the user login page with destination set to the path which you wanna access.
After you have enabled the module, you will find that the 403 path is set to /r4032login @ admin/config/system/site-information.
So now if an anonymous user wants to access the /admin page, he/she will be redirected to the following path.
After successfully login, the http://<domain>://admin page is shown. O.o wait, there is an extra “/” in the url. Although this will not affect the redirection, it is better remove it. I have raised this issue on the project page. (r4032login version: 7.x-1.5)
Currently, i hacked the r4032login.module as follow in order to solve the above problem.
function r4032login_redirect() { global $user, $language; if (user_is_anonymous()) { if (variable_get('r4032login_display_denied_message', TRUE)) { $message = variable_get('r4032login_access_denied_message', t('Access denied. You must login to view this page.')); drupal_set_message(t($message), 'error'); } $path = _r4032login_remove_language(request_uri()); // using drupal_goto() with destination set causes a recursive redirect loop // need to decode URL to prevent double-encoding UTF-8 characters https://drupal.org/node/1403616 /* fix the extra "/" by ykyuen - START */ //header('Location: ' . url('user/login', array('query' => array('destination' => urldecode($path)), 'absolute' => TRUE)), TRUE, 302); header('Location: ' . url('user/login', array('query' => array('destination' => urldecode(substr($path, 1))), 'absolute' => TRUE)), TRUE, 302); /* fix the extra "/" by ykyuen - E N D */ drupal_exit(); } ...
Done =)
Reference: Drupal module – Redirect 403 to User Login