Skip to content

Instantly share code, notes, and snippets.

@thamas
Last active December 19, 2015 00:48
Show Gist options
  • Save thamas/5870795 to your computer and use it in GitHub Desktop.
Save thamas/5870795 to your computer and use it in GitHub Desktop.
Drupal 7, Rules export. Use to redirect anonymous user to frontpage when she tries to access content using node/[nid] path. So content will be available only on its path alias.
{ "rules_access_w_alias_only" : {
"LABEL" : "Acces content with alias only",
"PLUGIN" : "reaction rule",
"TAGS" : [ "access" ],
"REQUIRES" : [ "rules" ],
"ON" : [ "node_view" ],
"IF" : [
{ "user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "1" : "1" } }
}
},
{ "AND" : [] },
{ "text_matches" : { "text" : [ "site:current-page:url" ], "match" : "node" } }
],
"DO" : [ { "redirect" : { "url" : "[site:url]" } } ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment