title: Redirection if query parameter exists on nginx
body: <p>I'm using IPB forums. I managed to use friendly urls with nginx server conf modifications. However I need to redirect my old forum's URLs to a redirector php file to get current url of a topic (or forum, member etc.). For example: if url is like <code>/forum/index.php?board=23</code>, I will do a redirection to redirector.php .</p>
  
  <p>This is my current configuration to be able to use friendly URLs on IPB</p>
  
  <pre><code>    location /forum {
          try_files $uri $uri/ /forum/index.php;
          rewrite ^ /forum/index.php? last;
      }
  </code></pre>
  
  <p>When I do insert an if statement inside this location block like the following, I can not retrieve query parameter "board". </p>
  
  <pre><code>location /forum {
          if ($arg_board != "") {
              rewrite ^ /redirector.php?q=$arg_board break;
          }
          try_files $uri $uri/ /forum/index.php;
          rewrite ^ /forum/index.php? last;
      }
  </code></pre>
  
  <p>What is missing in here?</p>