title: Using regex in nginx location block for variables
body: <p>Using nginx and CodeIgniter, I have a location block in my server config that handles the routing for my project like this:</p>
  
  <pre><code>location /beta/ {
      try_files $uri $uri/ /beta/index.php;
  }
  </code></pre>
  
  <p>This works fine, but I perform backups on this CodeIgniter project and move them to another folder.  The "beta" project gets renamed (with a time-stamp).  So I have a backups folder with CodeIgniter projects named as such:  </p>
  
  <pre><code>backups/beta_2013_05_21_0857
  backups/beta_2012_05_23_0750
  </code></pre>
  
  <p>What I'm trying to do is create another location rule that handles these variable-named projects, but all attempts at using regex so far have failed.  If I name the project directly it does work.</p>
  
  <pre><code>location /backups/beta_2013_05_21_0857 {
      try_files $uri $uri/ /backups/beta_2013_05_21_0857/index.php;
  }
  </code></pre>
  
  <p>But obviously I don't want to create a rule for each and every folder.  Does anyone have any idea on how to solve this?  This is the how I was trying to solve the problem:</p>
  
  <pre><code>location /backups/^\w+$/ {
      try_files $uri $uri/ /backups/$1/index.php;
  }
  </code></pre>