From 167add33fbe9f7a7aae7b773aa62c3127f32f7c9 Mon Sep 17 00:00:00 2001 From: Valentin Kuznetsov Date: Sat, 15 Jun 2024 16:17:32 -0400 Subject: [PATCH] Change r.URL.Path after permanent check --- main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/main.go b/main.go index a0adb1b..aa4fa21 100644 --- a/main.go +++ b/main.go @@ -212,9 +212,7 @@ func redirect(w http.ResponseWriter, r *http.Request) { // check for permanent redirects first if !InList(r.URL.Path, Config.PermanentRedirects) { path := fmt.Sprintf("%s/index.html", r.URL.Path) - path = strings.Replace(path, "//", "/", -1) - http.Redirect(w, r, path, http.StatusMovedPermanently) - return + r.URL.Path = strings.Replace(path, "//", "/", -1) } // get redirect rule map and rules (in reverse order) // here the reverse order will provide /path/rse /path/aaa followed by /path, etc.