blob: 4d3334287517028ad41da9804b92dfc7f8c9f880 [file] [log] [blame]
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package frontend
import (
"net/http"
"strings"
)
// handlePackageDetailsRedirect redirects all redirects to "/pkg" to "/".
func (s *Server) handlePackageDetailsRedirect(w http.ResponseWriter, r *http.Request) {
urlPath := strings.TrimPrefix(r.URL.Path, "/pkg")
http.Redirect(w, r, urlPath, http.StatusMovedPermanently)
}
// handleModuleDetailsRedirect redirects all redirects to "/mod" to "/".
func (s *Server) handleModuleDetailsRedirect(w http.ResponseWriter, r *http.Request) {
urlPath := strings.TrimPrefix(r.URL.Path, "/mod")
http.Redirect(w, r, urlPath, http.StatusMovedPermanently)
}