Redirects
redirect()
Section titled “redirect()”Kaelum provides a flexible redirect helper that supports single, map, and array syntax.
Single Redirect
Section titled “Single Redirect”app.redirect("/old", "/new");
// With custom status code (default: 302)app.redirect("/legacy", "/modern", 301);Map Syntax
Section titled “Map Syntax”Redirect multiple paths at once using an object:
app.redirect({ "/old-page": "/new-page", "/deprecated": "/current",});All map redirects use 302 by default.
Array Syntax
Section titled “Array Syntax”For fine-grained control over each redirect:
app.redirect([ { from: "/a", to: "/b" }, { from: "/c", to: "/d", status: 301 },]);Safe Replacement
Section titled “Safe Replacement”Calling redirect() for a path that already has a Kaelum redirect replaces the previous handler — no duplicate routes.