Rewrite-dispatch
From Resin 3.0
The <rewrite-dispatch> tag rewrites and dispatches rules similar to the Apache mod_rewrite module. It can appear in the <host> or the <web-app> tags.
Contents |
Overview
The <rewrite-dispatch> tag tries each sub-tag in order for a regular expression match. The first matching tag redirects the request.
Redirecting a URL
To redirect a URL with a HTTP 302 redirect use:
<rewrite-dispatch> <redirect regexp='^/foo' target='/bar'/> </rewrite-dispatch>
Forwarding a URL
To internally forward a URL to a target using the Servlet forward() call use:
<rewrite-dispatch> <forward regexp='^/foo' target='/bar'/> </rewrite-dispatch>
403 Forbidden
To send a HTTP 403 forbidden message for a URL, use:
<rewrite-dispatch> <forbidden regexp="^/foo"/> </rewrite-dispatch>
404 Not Found
To send a HTTP 404 Not Found message for a URL, use:
<rewrite-dispatch> <not-found regexp="^/foo"/> </rewrite-dispatch>
410 Gone
To send a HTTP 410 Gone message for a URL, use:
<rewrite-dispatch> <gone regexp="^/foo"/> </rewrite-dispatch>