aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPacien2013-07-11 16:32:52 +0200
committerPacien2013-07-11 16:32:52 +0200
commit19e1e4cc1c23772f691e73ecf7602348a81e83f8 (patch)
treea87e8846f08fd8f55786809a6af3e7be0b341f51
parent6c6767e9622aca9a965ac51156b09f4130819d61 (diff)
downloadfoldaweb-19e1e4cc1c23772f691e73ecf7602348a81e83f8.tar.gz
Add trailing slash to URLs (dynamic mode)
-rw-r--r--dynamic.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/dynamic.go b/dynamic.go
index 9df04b9..e2a2713 100644
--- a/dynamic.go
+++ b/dynamic.go
@@ -34,6 +34,12 @@ func handle(w http.ResponseWriter, r *http.Request) {
34 return 34 return
35 } 35 }
36 36
37 // redirect to add the trailing slash if missing
38 if !strings.HasSuffix(r.URL.Path, "/") {
39 http.Redirect(w, r, r.URL.Path+"/", http.StatusFound)
40 return
41 }
42
37 // get the list of dirs to parse 43 // get the list of dirs to parse
38 request := strings.TrimSuffix(r.URL.Path, "/") 44 request := strings.TrimSuffix(r.URL.Path, "/")
39 dirs := strings.Split(request, "/") 45 dirs := strings.Split(request, "/")