title: Nginx point subdomain to subfolder
body: <p>I want <a href="http://name.domain.com/" rel="nofollow">http://name.domain.com/</a> to point to <a href="http://www.domain.com/name" rel="nofollow">http://www.domain.com/name</a></p>
  
  <p>Just a notice, <strong>not</strong> to redirect to that location, but just point to it.</p>
  
  <p>So when I navigate to <a href="http://name.domain.com" rel="nofollow">http://name.domain.com</a>, the website display's content from <a href="http://www.domain.com/name" rel="nofollow">http://www.domain.com/name</a> </p>
  
  <p>What I tried so far:</p>
  
  <pre><code>server{
    listen 80;
    server_name name.domain.com;
  
    rewrite ^/name(.*) http://name.domain.com/$1 permanent;    
  }
  </code></pre>
  
  <p>The result is nginx returning <strong>404 not found</strong> error.</p>
  
  <p><strong>EDIT:</strong><br>
  I want the content of <a href="http://www.domain.com/name" rel="nofollow">http://www.domain.com/name</a> to be mapped on <a href="http://name.domain.com" rel="nofollow">http://name.domain.com</a> .<br>
  So when I navigate to <a href="http://name.domain.com" rel="nofollow">http://name.domain.com</a> I actually retrieve content from <a href="http://www.domain.com/name" rel="nofollow">http://www.domain.com/name</a></p>