I am trying to redirect everything that is under example.com/pictures back to the front page (i.e. I am hiding picture nodes to be directly viewable).

Neither the Pathauto module nor the Global Redirect module allows me to do this (or I am overlooking something). I cannot simply block users from viewing that particular node type.

Is it possible doing this with a module? Should I hack something up? Would an .htaccess rewrite help me?

I am interested in an answer for Drupal 7.

2 Answers 2


I assume "pictures", is a content type. If that's not the case, this may not work. Please provide more details about your setup in that case.

  1. Install the Chaos tool suite (ctools) module, and enable the Page Manager module
  2. Enable the node template
  3. Create a variant of type "HTTP response code".
  4. Set the response code to 301.
  5. Set the path to <front>
  6. Go to "Selection rules" in the left menu
  7. Add "Node:type == 'pictures'"
  8. Save

I belive you search for this module redirect.

Or you could use this example of an .htaccess 301 redirect, make sure your apache servers mod_rewrite is enable

# Redirect "dir/*" to "/"
RewriteRule ^dir/ http://example.com/ [R=301,L]
# no-www please
RewriteCond %{HTTP_HOST} ^www\.example\.com [NC]
RewriteRule (.*) http://example.com/$1 [R=301,L]

# 301 Permanent Redirects
Redirect 301 /dir http://example.com/
  • Thanks, but I forgot that I had redirect already enabled. But the problem is the same: it only allows for per url redirection, not recursive.
    – alex
    Jan 6, 2012 at 19:36

Your Answer

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

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