Skip to main content

redirect

Macro redirect 

Source
redirect!() { /* proc-macro */ }
Expand description

Create a redirect to a path or named route

§Examples

// Path redirect (starts with /)
redirect!("/dashboard").into()

// Named route redirect
redirect!("users.index").into()

// Redirect with route parameters
redirect!("users.show").with("id", "42").into()

// Redirect with query parameters
redirect!("users.index").query("page", "1").into()

For named routes, this macro validates that the route exists at compile time. Path redirects (starting with /) bypass validation and redirect directly.