By alex


2012-01-06 19:05:10 8 Comments

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 comments

@Letharion 2012-01-06 20:03:21

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

@witchcraft 2012-01-06 19:17:55

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/

@alex 2012-01-06 19:36:23

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.

Related Questions

Sponsored Content

3 Answered Questions

[SOLVED] After setting $base_url, I can only access the front page

  • 2014-01-11 18:45:44
  • Patrick Kenny
  • 1831 View
  • 4 Score
  • 3 Answer
  • Tags:   redirection

1 Answered Questions

[SOLVED] How to redirect user page to front page for specific roles

  • 2018-11-09 20:57:58
  • tasqyn
  • 1112 View
  • 4 Score
  • 1 Answer
  • Tags:   8 redirection

1 Answered Questions

[SOLVED] Redirect not obeying front page URL

  • 2018-04-03 12:39:11
  • John Cogan
  • 22 View
  • 0 Score
  • 1 Answer
  • Tags:   redirection

2 Answered Questions

[SOLVED] Redirect to the front page with a different language

  • 2016-09-01 08:51:21
  • Stephan Hofmann
  • 8284 View
  • 7 Score
  • 2 Answer
  • Tags:   8 redirection

8 Answered Questions

[SOLVED] Path alias creates redirect loop or redirects to the front page

1 Answered Questions

How to redirect all node aliases to <front>?

3 Answered Questions

Login Process Redirect Back to Page

  • 2015-10-26 02:35:35
  • Harry Respass
  • 187 View
  • 1 Score
  • 3 Answer
  • Tags:   users redirection

1 Answered Questions

How do I redirect access denied to front page?

3 Answered Questions

[SOLVED] Redirect to the registration page of the main domain

  • 2012-09-28 07:00:12
  • Villie
  • 203 View
  • 4 Score
  • 3 Answer
  • Tags:   redirection

Sponsored Content