title: How to use nginx if's param $1 in rewrite statement
body: <p>I have this working code in nginx config:</p>
  
  <pre><code>if ($http_host ~* ^www\.(.+)$) {
      set $host2 $1;
      rewrite  (.*)  http://$host2$1;
  }
  </code></pre>
  
  <p>I think that string <code>set $host2 $1;</code> may be omitted and $1 used in rewrite statement without defining some variables. But rewrite has own $1..$9 params.</p>
  
  <p>How I may use $1 form if in the rewrite statement?</p>