Added redirects for folio.red and workpad.dev
This commit is contained in:
parent
e76b827234
commit
a085ebf6f0
11
main.go
11
main.go
|
@ -19,7 +19,9 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
r := http.NewServeMux()
|
r := http.NewServeMux()
|
||||||
r.Handle("/", redirectTo("https://pub-d9610a73a30e4060aaf007864420dd0f.r2.dev"))
|
r.Handle("media.lmika.org/", redirectTo("https://pub-d9610a73a30e4060aaf007864420dd0f.r2.dev"))
|
||||||
|
r.Handle("folio.red/", redirectToJust("https://lmika.org/categories/old-projects/"))
|
||||||
|
r.Handle("workpad.net/", redirectToJust("https://lmika.org/categories/workpad"))
|
||||||
|
|
||||||
svr := http.Server{
|
svr := http.Server{
|
||||||
Addr: fmt.Sprintf(":%v", port),
|
Addr: fmt.Sprintf(":%v", port),
|
||||||
|
@ -38,3 +40,10 @@ func redirectTo(url string) http.Handler {
|
||||||
http.Redirect(w, r, newURL, http.StatusFound)
|
http.Redirect(w, r, newURL, http.StatusFound)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func redirectToJust(url string) http.Handler {
|
||||||
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
newURL := url
|
||||||
|
http.Redirect(w, r, newURL, http.StatusMovedPermanently)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue