title: Nginx: How to append a single query parameter
body: <p>Whenever it's a bot, I'd like to append a single query parameter at the end of the URL in nginx.</p>
  
  <p>So that URLs like <a href="https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9/" rel="nofollow">https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9/</a> will become <a href="https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9/?crawl=1" rel="nofollow">https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9/?crawl=1</a></p>
  
  <p>Or without the slash at the end <a href="https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9" rel="nofollow">https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9</a> will result into <a href="https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9?crawl=1" rel="nofollow">https://videomail.io/11e4-38ba-b1a12cc0-8849-cbb56781aee9?crawl=1</a></p>
  
  <p>If the parameter <code>crawl</code> already exist, no modification is wanted. How can I do that in nginx?</p>
  
  <p>I tried with this but it didn't work</p>
  
  <pre><code>if ($crawling = 1) {
      rewrite ^(.*)$ $1?crawl=1? break;
  }
  </code></pre>
  
  <p>Any clues?</p>