title: NGINX Redirect URL with Query Strings
body: <p>I have this NGINX configuration:</p>
  
  <pre><code>root    /var/www/web;
  index   index.php;
  
  server_name  domain.com;
  access_log  off;
  error_log on;
  
  location / {
      rewrite ^/(.*)$ /index.php?tag=$1&amp;page=1 last;
  }
  </code></pre>
  
  <p>Now, I want to redirect url something like 
  "domain.com/index.php?tag=1&amp;section=2&amp;type=3" to "domain.com/tag/section/type"</p>
  
  <p>how can I do that, where should I put the code? please help,</p>
  
  <p>Thankyou</p>
  
  <p>I already tried:</p>
  
  <pre><code>location / {
     rewrite ^/index\.php?tag=(.*)&amp;section=(.*)&amp;type=(.*)$ /$1/$2/$3 permanent;
     rewrite ^/(.*)$ /index.php?tag=$1&amp;page=1 last;
  }
  </code></pre>
  
  <p>but it didnt work..</p>