I have disabled user login block. I use Menu link to user/login for login. I also used CAPTCHA for login page. But now when I log in to site it stays on user/login page not redirect to front page and gives me an error The webpage cannot be found. Then after refreshing page it shows Access denied You are not authorized to access this page. Any one has idea to set login destination after login.

  • It might be worth checking the user table to see if Drupal is logging the user as having just logged in. We recently had a similar problem with a client's site which turned out to be a problem with cookies. If this is the case a good clean out of cache and cookies on the browser should rectify the problem. Jan 24, 2012 at 10:11

4 Answers 4


Check out the Rules module. This allows you to react on different events in your system. So it's also possible to redirect the user after he logged in successfully. I think this is the easiest way to achieve this without programming your own module.

  • Yes I checked that module. But after setting proper action It gives me again same error.
    – Abhijeet K
    Jan 24, 2012 at 7:55
  • Did you try it wit <front>?
    – Lance
    Jan 24, 2012 at 8:28
  • Yes it works I did it with help of steps in drupal.org/node/298506
    – Abhijeet K
    Jan 24, 2012 at 11:17

I think the Login Destination-module is what you're looking for! Easy to configure and works perfect!


You can try to do it programmatically by editing your theme's template.php file.

function YourThemeName_form_alter(&$form, $form_state, $form_id) {
    if ($form_id == 'user_login') {
        // on submit execute the YourThemeName_user_login_submit function
        $form['#submit'][] = 'YourThemeName_user_login_submit';

function YourThemeName_user_login_submit($form, &$form_state) {
    // redirect use to the homepage (front) on login
    $form_state['redirect'] = '<front>';

Just change the YourThemeName bit of the two functions to your theme's name. I hope this helps.


Use destination parameter in login links (if you use login form on separated page), you can set it in menu item settings (path change from user/login to user/login?destination=path/to/page).

This is better than using Rules because rule reacting on user login destroys Passwords reset process.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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