Redirects - Documentation topics on: redirect,redirects,.

Redirects

In Velocity, you can set redirects directly from a page or template without any external scripting. For example, you can add

$response.sendRedirect("$YOUR_NEW_URL")
#stop

to the top of pages or in your templates. This will send a 302 (temporary) redirect to the visitor's browser.  In case you need to control the redirect status (301/302), you can do the following:

$response.setStatus(301)
$response.setHeader("Location", "$YOUR_NEW_URL")
#stop

Because the above code is setting HTTP Headers, the code needs to be placed at the top of the page, before any html code to be sent to the browser/client.

Via Rewrite Rules (mod_rewrite)

If you have more complex rewrite needs, we suggest using the included RewriteRule filter which supports mod_rewrite like syntax and rewriting.