diff --git a/main.go b/main.go index 7b9cf38..7e5ebda 100644 --- a/main.go +++ b/main.go @@ -152,6 +152,13 @@ func main() { return } + // Append trailing slash to directories so rendered HTML has proper paths + if filestat.IsDir() && !strings.HasSuffix(r.URL.Path, "/") { + r.URL.Path += "/" + http.Redirect(w, r, r.URL.String(), http.StatusMovedPermanently) + return + } + // Use Browser Cache (if possible) modtime := filestat.ModTime().UTC() modhash := fmt.Sprint(modtime.Unix())