title: Using variables in Nginx rewrite rules
body: <p>I'm trying to map clean URLs to controllers of the same name. I'd like to just use a variable so that my config file doesn't become cluttered. I tried this:</p>
  
  <pre><code>location ^~ /$1 {
    rewrite ^ /controllers/$1.php last;
  }
  </code></pre>
  
  <p>But it doesn't seem to be working. Any ideas? </p>