title: Nginx directory path as arguments
body: <p>I'm trying to use the location block in nginx to pass directory paths into an index.php as get arguments. </p>
  
  <p>So the url <code>/api/arg1/arg2/</code> to be passed in as <code>/api/index.php?arg1=$1&amp;$arg=2</code></p>
  
  <p>Here is my attempt below, someone can help with the regex or a better approach.</p>
  
  <pre><code>location ~ "^/api/(\w+)/([A-z,0-9].*)/$" {
  
      alias /api/index.php?arg1=$1&amp;arg2=$2;
  
  }
  </code></pre>
  
  <p>Side note, the arguments to be passed are a single word with no whitespaces being made up of numbers and letters, no other symbols needed.</p>