summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2023-05-25 01:06:47 +0200
committerThomas Voss <mail@thomasvoss.com> 2023-05-25 01:06:47 +0200
commitebce06729ef86b0750808a4fb704bac57e9f60b8 (patch)
tree20f7f04b94e58a9773b4c95381c95bb6c889e0bc
parent065a159e5fb94733738c24664ea2bd222bebd203 (diff)
Some improvements
-rw-r--r--server.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/server.go b/server.go
index f5db168..dd73ebc 100644
--- a/server.go
+++ b/server.go
@@ -44,7 +44,7 @@ func router(w http.ResponseWriter, r *http.Request) {
Name: "redirect",
Path: "/",
})
- http.Redirect(w, r, lang + "/", http.StatusMovedPermanently)
+ http.Redirect(w, r, url + lang + "/", http.StatusMovedPermanently)
return
}
@@ -52,7 +52,7 @@ func router(w http.ResponseWriter, r *http.Request) {
parts := strings.Split(path, "/")
_, err = r.Cookie("redirect")
- if isSupportedLanguage(parts[0]) {
+ if isSupportedLanguage(parts[0]) && parts[0] != lang {
if r.Header.Get("Referer") == "" && err != nil {
parts[0] = lang
path = strings.Join(parts, "/")