title: Fatfree routing with PHP built-in web server
body: <p>I'm learning fatfree's route and found it behaves unexpected.</p>
  
  <p>Here is my code in index.php:</p>
  
  <pre><code>$f3 = require_once(dirname(dirname(__FILE__)). '/lib/base.php');
  $f3 = \Base::instance();
  
  echo 'received uri: '.$_SERVER['REQUEST_URI'].'&lt;br&gt;';
  
  $f3-&gt;route('GET /brew/@count',
      function($f3,$params) {
          echo $params['count'].' bottles of beer on the wall.';
      }
  );
  
  $f3-&gt;run();
  </code></pre>
  
  <p>and here is the URL which I access: <a href="http://xx.xx.xx.xx:8090/brew/12" rel="nofollow noreferrer">http://xx.xx.xx.xx:8090/brew/12</a></p>
  
  <p>I get a 404 error:</p>
  
  <pre><code>received uri: /brew/12
  Not Found
  
  HTTP 404 (GET /12)
  </code></pre>
  
  <p>the strange thing is that the URI in F3 is now "/12" instead of "/brew/12" and I guess this is the issue.</p>
  
  <p>When I check the base.php (3.6.5), $this->hive['BASE'] = "/brew" and $this->hive['PATH'] = "/12".
  But if F3 only uses $this->hive['PATH'] to match the predefined route, it won't be able to match them.</p>
  
  <p>If I change the route to:</p>
  
  <pre><code>$f3-&gt;route('GET /brew',
  </code></pre>
  
  <p>and use the URL: <a href="http://xx.xx.xx.xx:8090/brew" rel="nofollow noreferrer">http://xx.xx.xx.xx:8090/brew</a>, then the route matches without issue.
  In this case, $this->hive['BASE'] = "" and $this->hive['PATH'] = "/brew". If F3 compares the $this->hive['PATH'] with predefined route, they match each other.</p>
  
  <p>BTW, I'm using PHP's built-in web server and since $_SERVER['REQUEST_URI'] (which is used by base.php) returns the correct URI, I don't think there is anything wrong with the URL rewrite in my .htrouter.php.</p>
  
  <p>Any idea? What did I miss here?</p>
  
  <p>add the content of .htrouter.php here</p>
  
  <pre><code>&lt;?php
  
  #get the relative URL
  $uri = urldecode(parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH));
  
  #if request to a real file (such as a html, image, js, css) then leave it as it is
  if ($uri !== '/' &amp;&amp; file_exists(__DIR__  . $uri)) {
      return false;
  }
  
  #if request virtual URL then pass it to the bootstrap file - index.php
  $_GET['_url'] = $_SERVER['REQUEST_URI'];
  require_once __DIR__ . './public/index.php';
  </code></pre>