Using "Rabbit Hole nodes" and "Facebook Like Button" I am busy developing a Drupal 7 website. All nodes of content type "X" are displayed on my front page as well as on (possibly) multiple taxonomy term pages. But that is it, users are not allowed to access the single node page directly.


I have restricted the user's access to example.com/node/* pages using the plugin "Rabbit Hole nodes", redirecting them to example.com/#node-[node.nid] using the "Token" module.
I have also implemented the "Facebook Like Button" module to provide
a Like button for each node.


Each of these Like buttons are placed inside a generated iframe with following iframe Src.:

//www.facebook.com/plugins/like.php?href=http%3A%2F%example.com%2Fnode%2F1&amp;layout=button_count&amp;show_faces=true&amp;width=450&amp;font=arial&amp;height=80&amp;action=like&amp;colorscheme=dark&amp;locale=de_DE&amp;send=false

Note: Look at the "href" value that is passed along. It uses the exact URL pattern (../node/*) that I am restricting access to.

I asked myself these questions:


Does the Facebook crawler (user agent: facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php) actually have access to this? 
Will "Rabbit hole nodes" not break this like functionality?
Where will users from Facebook land when clicking on the Facebook
"like" notification of their friend? I mean, it's restricted..


[Update] How it should actually work:

When accessing the URL example.com/node/1 the following should happen:


Normal User (everyone except Facebook's crawler): Should be redirected to example.com/#node-1.
Facebook's crawler: Should not be redirected, instead it should just stay on the single node page example.com/node/1.


Possible solution:


One solution that I considered implementing is altering "Rabbit Hole nodes" module code and checking for the Facebook crawler user agent like this:

if (in_array($_SERVER['HTTP_USER_AGENT'], array(
  'facebookexternalhit/1.1 (+https://www.facebook.com/externalhit_uatext.php)',
  'facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)'
))) {
  // Don't execute Rabbit hole functionality
}
else {
  // Execute Rabbit hole functionality
}



What are your opinions, ideas and solution approaches?
Perhaps consider using Page Manager (part of Chaos Tools) to redirect users instead of the Rabbit Hole nodes module.


On the Page Manager admin page (Structure -> Pages) edit the node/%node page
Make a an HTTP response variant that redirects the user to site/#node-NUMBER when they are trying to reach site/node/NUMBER.
Set the selection criteria for that variant depending on the user agent (i.e. don't use this variant when facebook is looking).  This will  require a custom php rule.


There is an excellent Page Manager tutorial here.