title: Rails Redirect Route Bad Host Component
body: <p>So I'm trying to make a redirect in my routes.rb. I'm getting an error when I leave off my domain.</p>
  
  <pre><code>match "/partners/" =&gt; redirect("/partners.html")
  </code></pre>
  
  <p>Navigating to /partners/ gives this error page:</p>
  
  <pre><code>URI::InvalidComponentError
  
  bad component(expected host component): frontend_rails.dev
  </code></pre>
  
  <p>However, it does work if I put our full domain in the redirect.</p>
  
  <pre><code>match "/partners/" =&gt; redirect("http://example.com/partners.html")
  </code></pre>
  
  <p>But for my dev server I don't like links to go to our production server. According to the rails doc, this should be added automatically:</p>
  
  <blockquote>
    <p>In all of these cases, if you don’t provide the leading host (http://www.example.com), Rails will take those details from the current request.</p>
  </blockquote>
  
  <p>Any ideas why it's not liking my relative redirects? Thanks!</p>