Added redirects for folio.red and workpad.dev

This commit is contained in:
Leon Mika 2024-12-26 07:25:42 +11:00
parent e76b827234
commit a085ebf6f0

11
main.go
View file

@ -19,7 +19,9 @@ func main() {
}
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{
Addr: fmt.Sprintf(":%v", port),
@ -38,3 +40,10 @@ func redirectTo(url string) http.Handler {
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)
})
}