diff --git a/main.go b/main.go index b3e6580..1a9bc79 100644 --- a/main.go +++ b/main.go @@ -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) + }) +}