diff options
author | Pacien | 2013-07-11 16:32:52 +0200 |
---|---|---|
committer | Pacien | 2013-07-11 16:32:52 +0200 |
commit | 19e1e4cc1c23772f691e73ecf7602348a81e83f8 (patch) | |
tree | a87e8846f08fd8f55786809a6af3e7be0b341f51 | |
parent | 6c6767e9622aca9a965ac51156b09f4130819d61 (diff) | |
download | foldaweb-19e1e4cc1c23772f691e73ecf7602348a81e83f8.tar.gz |
Add trailing slash to URLs (dynamic mode)
-rw-r--r-- | dynamic.go | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -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, "/") |