The users can share the file download URL and user with credentials can download the file. All the things working fine. Once the user paste the download url in address bar, it redirects to login page and after successful login the file downloads. But its not redirecting to the loged in home page. Need to happen both things (file download & redirect to loged-in homepage) on successful login. How can we achive this.

  • This question has been answered here: stackoverflow.com/questions/15872534/… To summarise: redirect first, then initiate the download. Apr 16, 2015 at 10:59
  • I am using header("Location:); for downloading file. From there i need to redirect to homepage.
    – drup
    Apr 16, 2015 at 11:40
  • Please read the linked article carefully. You will need to use Javascript to achieve what you want but the basis of a solution is there. Apr 16, 2015 at 13:01

1 Answer 1


Try to use any of these modules. I hope below modules helps you to solve your issues :

  1. LoginToboggan
  • Allow users to login using either their username OR their e-mail address.
  • Allow users to login immediately.
  • Provide a login form on Access Denied pages for non-logged-in (anonymous) users.
  • The module provides two login block options: One uses JavaScript to display the form within the block immediately upon clicking "log in". The other brings the user to a separate page, but returns the user to their original page upon login.
  1. Login Destination

The Login Destination module allows you to customize the destination that a user is redirected to after logging in, registering to the site (7.x), using a one-time login link or logging out (7.x). The destination can be an internal page or an external URL. It is possible to specify certain conditions like referring pages or user roles and make the destination depend upon them. You may use PHP snippets to provide custom conditions and destinations. It is also possible to keep users on the currently visited page after logging in or out.

  1. Anonymous Login

This is a very simple, lightweight module that will redirect anonymous users to the login page whenever they reach any admin-specified page paths, and will direct them back to the originally-requested page after successful login.


You can do this by using Rules module.

The Rules module allows site administrators to define conditionally executed actions based on occurring events (known as reactive or ECA rules).

  • I need to pass the URL like /action=download&fid=123?destination=node/456 which download the file with id 123 first and then redirect to node/456. How can we achieve this. If done like this, after login its redirect to node/456 without downloading the file.
    – drup
    Apr 17, 2015 at 11:19

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.