Drupal 8 - How To Disable Access To Single Nodes With Rabbit Hole Module

Tutorial on how to control access to the /node/[nid] page.

Use Case

You have a view that lists articles but you want to disable access to single articles in node/[nid].


drush -y en rabbit_hole

How To Use It

Go to admin/modules and enable the entity types you want to restrict access to:

Go to admin/structure/types/manage/article and you can find the Rabbit Hole settings at the bottom.

Select Access denied as the behavior:

Now you can see the articles listed in the front page:

But if you click them, you get access denied:


Go to /admin/structure/types/manage/article

You can also choose Page not found behavior or make a Page redirect:

Install Token module to see the token widget in the image.

In this case you would be redirected to the login page whenever you try to access an article in node/[nid].

Overrides And Permissions

You can allow these settings to be overridden for single entities in /admin/structure/types/manage/article:

Edit any article and you have the option to change the behavior for that single entity:

You can also allow certain roles to bypass Rabbit Hole in /admin/people/permissions:


Samuli Natri (Entrepreneur, WDTutorials.com founder) has been building websites since the late 90's. He attended Helsinki University Of Technology (Computer Science) and Helsinki University (Social Sciences).

Latest Tutorial CKEditor Tutorial With CodeSnippet Syntax Highlighting

Copyright @ 2018 WDTutorials.com. All rights reserved. Privacy policy.Terms Of Service.