Skip to content

Commit

Permalink
Change r.URL.Path after permanent check
Browse files Browse the repository at this point in the history
  • Loading branch information
vkuznet committed Jun 15, 2024
1 parent cf62470 commit 167add3
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 167add3

Please sign in to comment.