diff --git a/staticfile.go b/staticfile.go index 0aad2c81..1cd75b8c 100644 --- a/staticfile.go +++ b/staticfile.go @@ -54,8 +54,13 @@ func serverStaticRouter(ctx *context.Context) { return } if fileInfo.IsDir() { - //serveFile will list dir - http.ServeFile(ctx.ResponseWriter, ctx.Request, filePath) + requestURL := ctx.Input.URL() + if requestURL[len(requestURL)-1] != '/' { + ctx.Redirect(302, requestURL+"/") + } else { + //serveFile will list dir + http.ServeFile(ctx.ResponseWriter, ctx.Request, filePath) + } return }