# Redirections

Jigsaw Home / Documentation Overview

Here we describe (with examples) what kind of redirection Jigsaw is able to perform and how to configure those redirections.

This document has the following sections:

- HTTP redirections
- Internal redirections
- Servlet mapping

# HTTP redirections

When a document has moved, for example `http://host1/Doc.html` is now reachable at `http://host2/Doc.html`, you should use the RelocateFrame.

With JigAdmin, remove the HTTPFrame of Doc1.html (the one at `http://host1/Doc.html`) and add a RelocateFrame, then set the location field to `http://host2/Doc.html`. Now, this frame will emit an HTTP redirect reply for every requests. Also, it can be configured to handle the PATH info so that you can remap http://host1/foo/(.*) to http://host2/bar/$1.

# Internal redirections

Sometimes, you need to perform internal redirections. For example, if you want requests on all documents with a `foo` extension to be redirected to a cgi script you will need to use the RedirecterFrame. Each document (with foo extension) must be indexed to a FramedResource associated to a RedirecterFrame (read the indexers documentation for more details) and the target field of the RedirecterFrame must be set to the cgi script url (eg: /cgi-bin/fooscript). It operates "behind the scene" as the client doesn't get a redirect (unless the target resource generate one). As of avril 29th 1999, it handles PATH_INFO.

# Servlet mapping

If you want to map an extension to a specific servlet, for example gnujsp servlet with jsp extension (FAQ), you need to perform an internal redirection that take care of the "path translated". The ServletMapperFrame is what you need. Configure it in the same way that the RedirecterFrame.

Note: this frame doesn't handle pathinfo (it doesn't make sense).