cmd/golangorg: fix and clean up m.golang.org redirect

Use http.RedirectHandler (forgot that existed before).
And add to validHosts so that the general golang.org doesn't kick in.

Change-Id: I80e4cd3f2324889bbda0ea42c17f73695c061abe
Reviewed-on: https://go-review.googlesource.com/c/website/+/342889
Trust: Russ Cox <rsc@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/golangorg/server.go b/cmd/golangorg/server.go
index d3d8795..8924abe 100644
--- a/cmd/golangorg/server.go
+++ b/cmd/golangorg/server.go
@@ -160,7 +160,7 @@
 	// Gmail itself can serve this redirect, but only on HTTP (not HTTPS).
 	// Golang.org's HSTS header tells browsers to use HTTPS for all subdomains,
 	// which broke the redirect.
-	mux.Handle("m.golang.org/", redirectAll("https://mail.google.com/a/golang.org/"))
+	mux.Handle("m.golang.org/", http.RedirectHandler("https://mail.google.com/a/golang.org/", http.StatusMovedPermanently))
 
 	if !isTestBinary {
 		go watchTip(&tipGoroot)
@@ -333,6 +333,7 @@
 var validHosts = map[string]bool{
 	"golang.org":       true,
 	"golang.google.cn": true,
+	"m.golang.org":     true,
 	"tip.golang.org":   true,
 	"beta.golang.org":  true,
 }
@@ -607,12 +608,6 @@
 	return (*fsys).Open(name)
 }
 
-func redirectAll(url string) http.Handler {
-	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-		http.Redirect(w, r, url, http.StatusMovedPermanently)
-	})
-}
-
 func redirectPrefix(prefix string) http.Handler {
 	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
 		http.Redirect(w, r, strings.TrimSuffix(prefix, "/")+"/"+strings.TrimPrefix(r.URL.Path, "/"), http.StatusMovedPermanently)