title: Retrieving query string parameters in Slim Framework 3
body: <p>I have a <code>get</code> route in the form</p>
  
  <pre><code>$app-&gt;get('/redirect[/{subject}]', function ($request, $response, $args) {
  
  });
  </code></pre>
  
  <p>If I make a request to <code>/redirect/server?site=local&amp;name=john</code></p>
  
  <p>I can get the <code>subject</code> right with</p>
  
  <pre><code>$request-&gt;getAttribute('subject')
  </code></pre>
  
  <p>However, I can't get the query parameters. If I inspect <code>$request-&gt;getQueryParams()</code> I get:</p>
  
  <pre><code>[
    '/redirect/server?site' =&gt; 'local',
    'name' =&gt; 'john'
  ]
  </code></pre>
  
  <p>Whereas I'd be expecting the query params to be</p>
  
  <pre><code>[
    'site' =&gt; 'local',
    'name' =&gt; 'john'
  ]
  </code></pre>
  
  <p>What am I doing wrong? Perhaps I should specify that the url parameter mustn't accept a question mark? </p>
  
  <p><strong>Edit 1</strong> </p>
  
  <p>I've been asked to post my webserver config. I'll have access to that dev machine tomorrow, so this is just a reminder to myself to add said info. <strong>However</strong> @jmattheis already gave me a hint.</p>
  
  <p><a href="https://www.slimframework.com/docs/start/web-servers.html#nginx-configuration" rel="nofollow noreferrer">Slim Framework 3 setup for nginx</a> says something along the lines</p>
  
  <pre><code>location / {
          try_files $uri /index.php$is_args$args;
      }
  </code></pre>
  
  <p>Whereas I'm using the rewrite snippet that used to be suggested for slim 2 at some point in time:</p>
  
  <pre><code>location / {
          try_files $uri $uri/ /index.php?$request_uri;
      }
  </code></pre>
  
  <p>This config has worked fine for me for years, but it happens that I've never tried to parse whatever came after the question mark. It is just now that I have forked an abandoned project that I'm trying to transform raw <code>$_REQUEST</code> parsing into Slim routing methods.</p>
  
  <p><strong>Edit 2</strong></p>
  
  <p>The codebase for the project is in the repo <a href="https://github.com/HuasoFoundries/phpPgAdmin6" rel="nofollow noreferrer">phpPgAdmin6</a>. It's basically a fork of <a href="https://github.com/phppgadmin/phppgadmin" rel="nofollow noreferrer">phpPgAdmin</a> that had no route logic, so I'm trying to centralize requests and responses to a given extent, and parse the query string using Slim native methods.</p>