title: Capture query parameters in nginx rewrites
body: <p>I saw an nginx rewrite rule that captured the query parameters from the URL and applied the same query parameters to the rewritten URL. I can understand that in some circumstances it could/would be beneficial to capture the query parameters in the rewrite rule, but it seems to me that in this situation doing so is pointless.</p>
  
  <p>The rewrite rule in question is as follows:</p>
  
  <pre><code>rewrite ^/users/(\d+)\.html(?:\?(.*))?$ /users/profile.php?id=$1&amp;$2 last;
  </code></pre>
  
  <p>Is this pointless as I suspect? I believe that the following rewrite rule would have the same effect:</p>
  
  <pre><code>rewrite ^/users/(\d+)\.html$ /users/profile.php?id=$1 last;
  </code></pre>