How to redirect user using Rules when user visits a link with view? I have a rule that redirects a user when visiting a view. But it does not work with the event "view page" or "Drupal is initializing".

Here is the rule:

{ "rules_uid_141" : {
"LABEL" : "uid=141",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "redirect manager" ],
"REQUIRES" : [ "rules", "pathrules" ],
"ON" : { "node_view--page" : { "bundle" : "page" } },
"IF" : [
  { "data_is" : { "data" : [ "site:current-user:uid" ], "value" : "38" } },
  { "pathrules_checkpath" : { "path" : "team", "operation" : "equals" } }
],
"DO" : [ { "redirect" : { "url" : "team?field_manager_uid=38" } } ]
  }
}


Any suggestions?
Use 'Drupal is initializing'

To get this to work, you should be able to use the "Drupal is initializing" event (which is NOT shown in the rule included in your question). That will ensure that the rule gets triggered BEFORE the actual content of your "link with view" is shown (otherwise you are too late, it "is" already shown).

Use a 'Regular Expression'

That link that you want to "intercept", should be formatted in some type of regular expression, which you then use as your Rules Condition. So that you have a rule that corresponds to "before showing the actual content of something that matches a specific path ...". After you get that part to work, your Rules Action is probably fine.

Sample rule

Refer to the "Option 1" part of my answer to the question about "How to restrict access to a node via node/12 and allow access via a path like content/sometitle?", which contains this Rule in export format:

{ "rules_check_url" : {
    "LABEL" : "Disallow node/* access",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : {
          "text" : [ "site:current-page:url" ],
          "match" : "node\/\\d+$",
          "operation" : "regex"
        }
      }
    ],
    "DO" : [
      { "drupal_message" : {
          "message" : "Sorry, URLs like [site:current-page:url] are not allowed around here ...",
          "type" : "error"
        }
      },
      { "redirect" : { "url" : "no_access" } }
    ]
  }
}


Here is some suggested tuning of the above sample to make it work for your case also:


machine name and label.
replace the node/* by your path of your view (in the "label", and the regular expression).
replace the action part of the rule by your action that you have already.


Note: the rule included in your question also shows that you tried to use the Path Rules module, which implements Rules Conditions for checking an URL against a given string for triggering Rules Actions. That module is another interesting add-on module the Rules, but if you just use a regular expression as shown in my answer, you don't need that module for getting your rule to work.