Restrict node to be shown only in a view and not by its url? I created a node which has an entity reference to select a user. Then, I created a view to show the node only to the user referenced in the node.

This works fine, but the problem is that the node can be viewed directly through its URL. I need to restrict the node to be only shown through the view and not by its URL.

How can I do this?
The purpose of the Rabbit Hole module is exactly that, even if it doesn't apply just in the view case.


  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.


The module has a version for Drupal 7 and Drupal 8, although the later is still a beta version, on December, 2019.