Main menu

Page manager redirect

1 July 2010

Quite often you need to redirect a particular path on a Drupal site, there are a number of ways to do this, but most involve writing PHP code. Also, it's not hugely easy to do things like redirect node/%node but only when %node is a 'image' node, posted on a Tuesday. The awesome Page manager module, and a little utility module we wrote changes that.

Page manager redirect Drupal module exposes a 'task handler' to Page manager. This means that we can do a 'task' when page manager matches a path, and other conditions pass; The task that Page manager redirect exposes is to redirect to another page.

This allows us to easily set up things like redirecting a user's profile node to the user whose profile it is, or redirect individual image nodes in a gallery to the gallery they belong to.

The module hooks into the awesome power provided by the Page manager module, so you load up contexts from wherever, and then use them as tokens in the path for redirection.

The Page manager redirect module is still in development, and we still have a tiny bit of work to do before releasing a stable version. Feel free to try it out and report any issues in the queues!

About the author

Steven has a wealth of experience building Drupal-based websites and tools associated with them. He is a maintainer of the Aegir project and has contributed to many other projects on Drupal.org. He is currently our infrastructure lead and is a lead architect on many of our projects.

He is a Master of Mathematics graduate from the University of Warwick and got involved in Drupal creating a website for the Maths society there.

Comments

Rules is a massively complex beast, I'm not sure I'd want rules being executed on every single page load, as they are quite slow. Also, Page Manager handles the task better, it is a purpose built 'change what happens on this path' machine. It can also add new paths easily, and has a much more friendly UI.

Basically using Rules would only be useful for the conditions part, but would suck for everything else.

Comments on this article are now closed, if you want to give us feeback you can use our contact form instead.