Rule + redirect

by Tourist   Last Updated November 15, 2017 11:07 AM

I want all my anonymous users to be redirected to a specific page. I created a rule for this : https://imgur.com/mUl8H9Q

It works, all anonymous are redirected to the page "espace press" and they can log in/create account.

But now, I want to allow my anonymous to view a specific content type (called CP) + the front page. Then they would be redirected if they try to view any page except the front page or a CP page.

What do I need to change in my rule to make it happen in drupal 7?

The code for my rule :

{ "rules_login" : {
"LABEL" : "login",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"TAGS" : [ "login" ],
"REQUIRES" : [ "rules" ],
"ON" : { "init" : [] },
"IF" : [
  { "user_has_role" : {
      "account" : [ "site:current-user" ],
      "roles" : { "value" : { "1" : "1" } }
    }
  },
  { "NOT text_matches" : { "text" : [ "site:current-page:url" ], "match" : "espace-presse" } },
  { "NOT text_matches" : { "text" : [ "site:current-page:url" ], "match" : "user\/login" } },
  { "NOT text_matches" : { "text" : [ "site:current-page:url" ], "match" : "user\/register" } },
  { "NOT text_matches" : { "text" : [ "site:current-page:url" ], "match" : "user\/password" } },
  { "NOT text_matches" : { "text" : [ "site:current-page:url" ], "match" : "user" } }
],
"DO" : [ { "redirect" : { "url" : "espace-presse" } } ]

} }

Tags : rules redirect


Related Questions



delete certain redirect using rules

Updated June 08, 2015 22:03 PM

Any way to have "Path Will Be Viewed" trigger?

Updated July 17, 2016 08:03 AM

redirect to a page after account delete

Updated August 22, 2016 08:04 AM