I have made a video gallery using Views. But I only want that the page accessible to public and prevent access to each of the videos individually.

The videos had to be created as a type of content, so all of them have accessible ULRs like /content/video-1, etc.

7 Answers 7


Try content access module and prevent access to video content individually( or also you can set access to it for you desire roles )

This module allows you to manage permissions for content types by role and author. It allows you to specifiy custom view, edit and delete permissions for each content type. Optionally you can enable per content access settings, so you can customize the access for each content node.

Also you can use Node View Permissions module, but I suggest use Content access module.

(if you want work with drupal for future is better getting involve with this useful modules)

  • Almost what I needed. Finally I did control the access via low-level, because wanted to redirect to home page in some cases, 404 in others, etc., so I had better control, but I think this module could work in most of the cases. Maybe with a better adjust in my case, but had no time to investigate.
    – Cesar
    Commented Dec 15, 2015 at 15:11

Install Node View Permissions module.

Node view permissions module enables permissions "View own content" and "View any content" for each content type on permissions page as it was on Drupal 6.

Now goto permission page and remove View any content permission from video content type for Anonymous user.

In case you want only few of the videos from Video gallery to be accessible to the anonymous user, then install Deny Access module.


Just update your content type.

  1. Add a numeric field like display_order etc.

  2. Set value of this field only for those videos you want to show.

  3. Go to your view settings and set;

    Use pager:Display a specified number of items | x items

    where x is the no.of videos you want to show

  4. Then apply sorting by display-order

Hope it will work.


I think the Rabbit Hole module does exactly what you're looking for. Here's an excerpt from the module's description page answering your need. Good luck.

Rabbit Hole is a module that adds the ability to control what should happen when an entity is being viewed at its own page.

Perhaps you have a content type that never should be displayed on its own page, like an image content type that's displayed in a carousel. Rabbit Hole can prevent this node from being accessible on its own page, through node/xxx.


Go for rabbit hole module, it does exactly the same. All the content is accessible via views/code but when you try to access the detail page "content/***" it is either access denied or you can set a redirect.

  • I will give it a ride, thanks. For the moment, I have solved it at low level, but it is best to know already done custom modules.
    – Cesar
    Commented Jan 7, 2016 at 7:23

1) Create a Boolean value field in your content type.

2) If value is selected as true a unique class should be added to that video field, if value is selected as false the class should not be added to that video field.

3) Write some CSS to hide the videos where the class is not present.


Using the Rules module you can implement a rule that looks similar to this:

{ "rules_disallow_accesss_to_selected_urls" : {
    "LABEL" : "Disallow access to selected URLs",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "rules" ],
    "ON" : { "init" : [] },
    "IF" : [
      { "text_matches" : {
          "text" : [ "site:current-page:url" ],
          "match" : "content\/video-1",
          "operation" : "regex"
    "DO" : [
      { "drupal_message" : {
          "message" : "Sorry, access to URLs like [site:current-page:url] is not allowed ...",
          "type" : "error"
      { "redirect" : { "url" : "no_access" } }

Anybody trying to access relative path content/video-1 will be redirected to a page with path no_access, and a related error message will be shown (adapt this path to fit your own conventions, and review the message to be shown).

The above rule only restricts access to relative path content/video-1 (as in your question). If you want to expand the rule to similar URLs, change content\/video-1 to something like content\/video-\\d+$, or any variation that fits the naming convention of your paths.

The above rule does not (yet) take into account to only apply the Rules Action for users with selected roles only. But for anybody a bit familiar with the Rules module, that is a straight forward "Condition" to add ... eg: skip the rules action for users with a role like editor, administrator, etc. Which you can do by adding a Rules Condition like "user does NOT have role administrator (and/or editor)". That way those kinds of special users can still view such nodes anyway (without such extra condition they also cannot view such nodes anymore ...).

To experiment with this rule in your own site, just copy the entire Rules code above, and paste it in a new Rule in your own site, created via the "Import" function (available if Rules UI is enabled). Then further edit/refine to make it fit in your own environment (e.g the "Sorry, ..." message to be shown).

Additional refinement

In one of the other answers you added a comment that includes this:

... I wanted to redirect to home page in some cases, 404 in others, etc., so I had better control ...

If that's what you also want to do, then you can further refine the above Rules Action by adding the Conditional Rules module also. With that, for each of your "some cases" you can then specify the appropriate URL to redirect to. Refer to my answer to "How to set the values of some fields depending on the value of a list box?" for an illustration of how to use this module within a Rules Action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.