Last updated 9 January 2012. Created on 4 May 2010.
Edited by drupalisme, klflote, Francewhoa. Log in to edit this page.

In this tutorial we will use the Trigger core module to configure a simple page redirection after a user has logged in. You may also use Rules module described here http://drupal.org/node/939876.

Requirements

  • Drupal 6.x
  • Trigger core module under admin/build/modules

Optional

  • Token contributed module if you want to use tokenized URL. Make sure that the Token sub-module Token actions is activated.

Steps

  1. We are now going to create an action. To do so go to Actions settings page under admin/settings/actions
    • Going to Make a new advanced action available.
    • Choose Redirect to URL.... Click on Create button.
      Note that if you want to use a tokenized URL then choose Redirect to a tokenized URL...
    • A new window opens Configure an advanced action
      - Description: Redirect to particular page
      - URL: <front>

      More URL: examples

      • <front> will redirect user to your site default front page. As defined under admin/settings/site-information.
      • user/[user-id]/track will redirect user to user's Track page. To read more about tokenized actions expend the Placeholder tokens section located at the bottom of Configure an advanced action page.

      Note that you must install Token contributed module if you want to use tokenized URL. Plus you must activate the Token sub-module Token actions.

    • Click on Submit button. You have successfully created an action.
  2. We are now going to create a trigger. To do so go to admin/build/trigger
    • Click on Users tab.
    • Choose Trigger: After a user has logged in.
    • Choose an action Redirect to particular page
    • Click on Assign button.

That's all. To test log-out and log-in. You'll be redirected.

Important Note!

If it doesn't work then check if you have another redirection. A Views can redirect to any page. I suggest you try this tutorial on a clean install of Drupal, so you will have better understanding how Drupal's Trigger works.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

swati_patel_8497’s picture

Hello,
When I login into drupal site,I want to redirect the site to a particular URL.I am following these steps of triggers and actions,but its not working.Its redirecting me to the home page.So what can be the problem?any idea?

Thanks,
Swati

Ayesh’s picture

Make sure that you don't use logintoboggan.module.

If you are using pathauto, use that tokenized path.

i.e . When the user - 1 log in, redirect should be,
/user/%uid

try it once,
else, help available at
ayeshlakmal+drupalforum@gmail.com

// Ayesh

debplatt’s picture

On log in, I wanted the user to be redirected to his profile page. I have set up the following redirect destinations:

  • user/[uid]
  • node/50

Both of the above destinations map to the same user's profile page (I am using advanced profile kit, so the user's profile is a node). I have successfully bound these redirect actions to any node trigger (for example, on new content creation, or on updating content). However when I've tried binding them to the user-log-in trigger, they don't work.

In an attempt to try to get any action bound to the user-log-in trigger, I also tried binding the action which resets the user's number of posts to zero. This also did not work.

FFFFFFFab’s picture

I've tried the same thing : the redirection is functionnal when associated with new content creation trigger but not with user login trigger...
(excuse me for my english... i'm french...)

anaperes’s picture

Same for me...
I'm really getting at this point that I'm want to gave up on drupal :s
I get a lot of errors and trying to design one job website it is a gigantic task with no light in the end of the tunnel.

jzornig’s picture

I trying to redirect on user login in D7 and it still goes to the site home page.

drupalisme’s picture

Its redirecting me to the home page

This mean works fine :) because by default after loggged in then you will redirect to User Account page. Check again your "Redirect URL" entry. This tutorial use <front> for example, change to your desired URL.

davedg629’s picture

This seems to only work when a user logins in from the /user page, not from a login block placed in the sidebar or somewhere else on your site.

gatman’s picture

Confirming that it does not work from the login block.

Francewhoa’s picture

If not working then edit your action and check the option Force redirecting to the given path, even if a destination parameter is given

Loving back your Drupal community result in multiple benefits for you  
dark_kz’s picture

Sorry, but in the action settings or trigger - i don't have "Force redirecting to the given path, even if a destination parameter is given"
What i gotta do? Help me! Thanks =)

trentharlem’s picture

"Force redirecting to the given path, even if a destination parameter is given" is from the rules module... http://drupal.org/project/rules

drupalisme’s picture

I just fixed this tutorial, make it more simple and remove Rules module parts.
Tested and work on Drupal 6.