title: How to configure nginx to auto redirect to the main hostname?
body: <p>Each nginx config can act for a wide range of domains but I want to auto-redirect requests to the first domain name (the official one).</p>
  
  <pre><code>server {
      server_name a.example.com b.example.com;
  }
  </code></pre>
  
  <p>I want that if someone enters <code>b.example.com/some</code>, to go directly to <code>a.example.com/some</code></p>