Even though the currently accepted answer may have helped to solve the issue in the question, I think it is not 100% accurate (not correct, maybe even a bit misleading). Moreover there is an alternative solution also. Read on for more details ...
About using Rules Weight
To indicate a "weight" for a custom rule, you use the field in the rules UI that looks like so:
Note what is written below that weight field, i.e "Order rules that react on the same event. Rules with a higher weight are evaluated after rules with less weight
".
Let's apply this to what's suggested in the currently accepted answer:
That's indeed "a" way to get it to work (to meet the specs as in the question). However, it does also mean that BOTH rules are executed, for anybody (not just admins ...) who performs a login:
- The 1st rule for authenticated users gets executed for anybody who performs a login (note: so also for admins ...). That is, the redirect to
node/90
gets executed.
- Authenticated users that do not have the admin role, do not satisfy the Rules Condition, so the Rules Action of the 2nd rule for admin does not execute.
- Authenticated users that do have the admin role, do satisfy the Rules Condition, so the Rules Action of the rule for admin does execute. That is, the redirect to
node/25
gets executed also.
The result of this is that for a use that has the admin role, actually 2 redirects are performed: first to node/90
(as per the 1st rule), followed by a redirect to node/25
(as per the 2nd rule). For those who don't believe (or get) it: just add a Drupal action like "Show a message on the site" in both rules (for admins you'll get both messages).
Alternative to using Rules Weight
Apart from redundant Rules logic that gets executed (as explained above), using Rules Weights to get things to work (= implement the appropriate execution sequence) has some challenges, which I try to avoid whenever possible.
In this case (= scenario in the question), an alternative solution appears to be to use the Conditional Rules module. Have a look at this rule (in Rules export format) which uses this module, and which also implements the very same logic as described in the question:
{ "rules_redirect_each_role_to_separate_page" : {
"LABEL" : "Redirect selected roles to selected pages",
"PLUGIN" : "reaction rule",
"ACTIVE" : false,
"OWNER" : "rules",
"REQUIRES" : [ "rules_conditional", "rules" ],
"ON" : { "user_login" : [] },
"DO" : [
{ "CONDITIONAL" : [
{
"IF" : { "user_has_role" : { "account" : [ "account" ], "roles" : { "value" : { "3" : "3" } } } },
"DO" : [ { "redirect" : { "url" : "node\/25" } } ]
},
{ "ELSE" : [ { "redirect" : { "url" : "node\/90" } } ] }
]
}
]
}
}
After you enabled the Conditional Rules module, just use the Rules UI to import the above rule in your own site, enable the rule, and see what happens ... No need for "Rules Weight", and only using a single rule (to see the entire Rules logic in a single screen when using the Rules UI). And for users that do have the admin role, there is no (repeat: no) redundant redirect to node/25
.
What is more: imagine that you'd have to implement a redirect that depends on (say) 5 roles, so that you need to redirect to one of 5 pages. All it's take is to extend the IF/THEN/ELSE logic with 3 more appropriate redirects (instead of tuning the Rules Weights for 5 different rules ...).
node->97
withnode/97
?