You can use the Rules module to restrict access to those selected pages. Here is a rule (in Rules export format) which should be pretty close to implement such access restrictions as you're asking for:
{ "rules_limit_access_to_some_urls_" : {
"LABEL" : "Limit access to some URLs",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules" ],
"ON" : { "init" : [] },
"IF" : [
{ "user_has_role" : {
"account" : [ "site:current-user" ],
"roles" : { "value" : { "1" : "1" } }
}
},
{ "OR" : [
{ "data_is" : {
"data" : [ "site:current-page:path" ],
"op" : "IN",
"value" : { "value" : [
"node\/add",
"user",
"user\/register",
"user\/login",
"node\/200",
"node\/500"
]
}
}
},
{ "text_matches" : {
"text" : [ "site:current-page:url" ],
"match" : "node\/\\d+\/something",
"operation" : "regex"
}
}
]
}
],
"DO" : [
{ "redirect" : { "url" : "no_access" } },
{ "drupal_message" : {
"message" : "Access to the content located at the path you tried to use is not allowed.\r\n\u003Cbr \/\u003E\r\nIf you think this is an error, please contact us.",
"type" : "warning"
}
}
]
}
}
Check the paths in the above rule to ensure it fits your own needs. Also note that I include an extra path that corresponds to "node/*/something
" (in case you'd also want to limit access to any such URL. Replace the something
in it to fit your needs. Or if you don't have such URLs then just remove that entire Rules Conditions (with the regex
in it).
And indicate the correct path of the redirect to be perform (= change the "no_access
" make it fit your "no access" page). Possibly you may also want to adapt the roles for which these validations should be applied.
For more details/background about using such rule, refer to my answer to the question "How to make the permissions of a module more granular?".