Redirect slash for folders
alex wennerberg alex@alexwennerberg.com
Sat, 09 Jan 2021 23:21:29 -0800
1 files changed,
4 insertions(+),
0 deletions(-)
jump to
M
http.go
→
http.go
@@ -580,6 +580,10 @@
var geminiContent string _, err = os.Stat(path.Join(fullPath, "index.gmi")) if isDir { + // redirect slash + if !strings.HasSuffix(r.URL.Path, "/") { + http.Redirect(w, r, p+"/", http.StatusSeeOther) + } if os.IsNotExist(err) { if p == "/gemlog" { geminiContent = generateGemfeedPage(userName)