title: Automatically 301 Redirecting in Go
body: <p>I'm trying to redirect a url to a different url (either 301 or 301). Basically, I'm looking for the go equivalent of following php code:</p>
  
  <pre><code>&lt;?php
  // Permanent redirection
  header("HTTP/1.1 301 Moved Permanently");
  header("Location: http://google.com/");
  ?&gt;
  </code></pre>
  
  <p>So far this is what I've done:</p>
  
  <pre><code>writer.Header().Set("Location", "http://google.com")
  writer.WriteHeader(301)
  </code></pre>
  
  <p>And also:</p>
  
  <pre><code>handler := rawHttp.RedirectHandler("http://google.com", 301)
  handler.ServeHTTP(writer, req)
  </code></pre>
  
  <p>It 'kind of' works. The only problem is it write a 'Found' text with a link to <a href="http://google.com" rel="nofollow">http://google.com</a> so I've to click it. I want it to redirect automatically without displaying a 'Found' link.</p>