Not sure if it will be your only probemproblem to be fixed, but you seem to be using the wrong token in your condition path. Try again using [site:current-page:path]
.either of these tokens:
[site:current-page:path]
.[site:current-page:url]
.
ForBelow is an example of a rule (in Rules Export format) that uses this [site:current-page:path]
token, and which you might wantillustrates how to use to create a variationeither of these tokens:
{ "rules_redirect_logged_in_user" : {
"LABEL" : "Redirect logged in user",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "init" : [] },
"IF" : [
{ "NOT user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "1" : "1" } }
}
},
{ "OR" : [
{ "data_is" : { "data" : [ "site:current-page:path" ], "value" : "node\/123" } },
{ "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "something" } }
]
}
],
"DO" : [
{ "drupal_message" : { "message" : "Using the path [site:current-page:path] (or url [site:current-page:url]) makes no sense for authenticated users, which is why you are redirected ..." } },
{ "redirect" : { "url" : "somewhere_else" } }
]
}
}
Some more details about the above Rule:
- Rules Event: Drupal is initializing.
- Rules Conditions:
- the user should NOT be anonymous, AND
- either (or both) of these conditions must be true:
- the path is
node/123
(assuming your homepage is a node withnid=8
, adapt to fit your case, or omit this condition if the next condition is sufficient for your case). - the url
contains
the textsomething
(adapt to fit your case, or omit this condition if the previous condition is sufficient for your case). Instead of using Comparison operationcontains
you could also usestarts with
,ends with
or even aregular expression
.
- the path is
- Rules Actions:
- Show an appropriate message (adapt to fit your needs, or just omit it if you don't want such message at all, I like it for debugging purposes ...).
- Perform a redirect to
somewhere_else
(adapt to fit your needs).
If you have the Rules UI enabled, you should be able to import the above rule in your own site. Then adapt it to fitfits your needs, refer to my answer and you should be good to "https://drupal.stackexchange.com/q/59598/39516"go.
Easy, no?