Skip to content

Redirects

Kaelum provides a flexible redirect helper that supports single, map, and array syntax.

app.redirect("/old", "/new");
// With custom status code (default: 302)
app.redirect("/legacy", "/modern", 301);

Redirect multiple paths at once using an object:

app.redirect({
"/old-page": "/new-page",
"/deprecated": "/current",
});

All map redirects use 302 by default.

For fine-grained control over each redirect:

app.redirect([
{ from: "/a", to: "/b" },
{ from: "/c", to: "/d", status: 301 },
]);

Calling redirect() for a path that already has a Kaelum redirect replaces the previous handler — no duplicate routes.