title: Nginx rewrite urls with special characters
body: <p>I just got a list of urls that needs to be rewritten into nginx</p>
  
  <pre><code>example.com/cms.php/inspiration?fullsize &gt; /
  example.com/shop/?category_id=27 &gt; /garden/cushion.html
  example.com/shop/?2008=1&amp;vare_id=10553&amp;variant_id=2232 &gt; /garden/cushion/black.html
  </code></pre>
  
  <p>I tried with the following</p>
  
  <p>Simple rewrite</p>
  
  <pre><code>rewrite /shop/?category_id=27 /garden/cushion.html permanent;
  </code></pre>
  
  <p>Location rewrite</p>
  
  <pre><code>location /shop/?category_id=27 {
      rewrite /shop/?category_id=27 /garden/cushion.html;
  }
  </code></pre>
  
  <p>And with location where I commented special signs</p>
  
  <pre><code>location /shop/\?category_id=27 {
      rewrite /shop/\?category_id=27 /garden/cushion.html;
  }
  </code></pre>
  
  <p>I add them directly into <code>server {...}</code> in the nginx configuration</p>