by Jeff Eaton

Module Monday: Rabbit Hole

Most complex Drupal sites eventually accrue a few... oddball content types. Sometimes it's a collection of ad nodes that should only appear in a rotator, other times it's special nodes that are only used when constructing a user's profile page, and many times it's impossible to predict until the site is complete. No matter the details, it's often useful to mask the normal node/1 URLs for those "ugly duckling" content types to ensure users don't stumble onto them accidentally. Unpublishing them entirely can be a pain, though, complicating Views and permission management. Enter... Rabbit Hole.

Screenshot of administration options

Rabbit Hole is a curiously named module that lets you control the behavior of the node view pages for each content type. Pop open the administration page for each content type, scroll down, and you'll see options to leave it as is, mask it entirely and generate a 404 error, or redirect to a different Drupal path or URL. Administrators can be given permission to override these redirects, viewing the normal node pages for these content types while users see the redirect or 404.

The only downside to Rabbit Hole is its lack of support for tokens in its per-content-type redirect paths. There's no way for the node/1 path to redirect to the user page of that node/1's author, for example. Adding token support would allow tricks like that, but even without that the module is a useful addition to any site builder's toolbox. Writing the same functionality in a custom module is a common task on most large sites, but Rabbit Hole. solves it for everyone. Give it a spin!