Skip to main content

Redirect

Redirect maps a path to another path.

app.Use(middleware.Redirect("/old", "/new"))

Pass a status code when the default 301 Moved Permanently is not right.

app.Use(middleware.Redirect("/login", "/signin", zinc.StatusTemporaryRedirect))

Wildcard redirects are supported through RedirectWithRules.

app.Use(middleware.RedirectWithRules(map[string]string{
"/v1/*": "/api/v1/*",
}))

Query strings are preserved.