Redirect
Redirects to the URL derived from the specified path, with specified status, a positive integer that corresponds to an HTTP status code.
If not specified, status defaults to 302 Found.
func (c *Ctx) Redirect(location string, status ...int) error
app.Get("/coffee", func(c *fiber.Ctx) error {
c.Redirect("/teapot")
})
app.Get("/teapot", func(c *fiber.Ctx) error {
c.Status(fiber.StatusTeapot).Send("🍵 short and stout 🍵")
})
app.Get("/", func(c *fiber.Ctx) error {
return c.Redirect("/foo/bar")
return c.Redirect("../login")
return c.Redirect("http://example.com")
return c.Redirect("http://example.com", 301)
})