func handler(ctx *context.Context) { ctx.Redirect(302, "/new-url") }
func handler(ctx *context.Context) { ctx.Redirect(301, "https://example.com/new-url") }
func handler(ctx *context.Context) { ctx.RedirectSubpath("/subpath") }This example redirects the request by adding "/subpath" to the current URL subpath. The function belongs to the context package of the gogs/modules library.