title: How do I redirect from an exact url in golang?
body: <p>Whenever a request is made from localhost:9000/ I want to redirect the user to localhost:9000/#/trade/gem/GEM . The problem I am getting is that I get infinite redirects because "/" preceeds every url. How do I make it so that the user is only redirected if they visit the exact url of localhost:9000/ ? My code is below:</p>
  
  <pre><code>var newUrl string = "/#/trade/gem/GEM"
  
  func handleRedirect(rw http.ResponseWriter, req *http.Request) {
      http.Redirect(rw, req, newUrl, http.StatusSeeOther)
  }
  
  func main() {
      http.Handle("/#/trade/", fs)
      http.HandleFunc("/", handleRedirect) //This is the exact url I want to redirect from
      http.ListenAndServe(":9000", nil)
  }
  </code></pre>