You are here: Home Zope products Products.JRedirector

Products.JRedirector (1.4)

by Olha Pelishok last modified 2009-06-23
Released on 2009-06-23 by Jens Vagelpohl for Zope 2.8 under LGPL - GNU Lesser General Public License available for All platforms.
Software development stage: stable
Simple Zope 2 redirection manager object

The JRedirector package provides an object that is capable of redirecting web requests in a controlled fashion and keeping logs about it.

I wrote it so that when I move pieces of my sites around I have a way of specifying where users will go if they navigate to the old obsolete location. This is helpful if your site is linked from other sites and you have no control over the accuracy of these outside links.

The administrator can add mappings from old path to new path where the user will be redirected to when he tries to visit the old path. The HTTP header sent along with this redirect can be specified, available choices are "301" (moved permanently) or "302" (moved temporarily).

The object will keep an internal log of all web requests that are referred to it and presents it on a logging output page.


The administrator creates a JRedirector object in a given location in site. Invoking the redirection capabilities must happen explicitly, for example from standard_error_message, by calling the JRedirector object and passing REQUEST.

As an example, here is the snippet of my standard_html_error that invokes the JRedirector object:

<dtml-if expr="error_type == 'NotFound'">
<dtml-call expr="redirector_object(REQUEST)">

This will fire whenever a "NotFound" error occurs. If the path the user attempted to go to is not in the explicitly mapped list of paths defined by the administrator in the JRedirector object "Mappings" tab then nothing will happen and the standard_error_message will continue to render normally. If the looked-for path is explicitly mapped then the user will be redirected and will never see standard_error_message.

Document Actions
Powered by Plone