title: PHP page routing, working on localhost:3000 but not on localhost/dir/
body: <p>The below code snippet works great when run on <strong>localhost:3000</strong> but stops working when I run it on <strong>localhost/dir/</strong> and for every thing shows the default case result even for a <strong>/</strong></p>
  
  <pre><code>    &lt;?php
      // Grabs the URI and breaks it apart in case we have querystring stuff
      $request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
      // Route it up!
      switch ($request_uri[0]) {
          // Home page
          case '/':
              echo "/ here\n";
              break;
          // About page
          case '/about':
              echo "about.php is opened from here\n";
              break;
          // Everything else
          default:
              header('HTTP/1.0 404 Not Found');
              echo "404 is opened from here \n";
              break;
      }
      ?&gt;
  </code></pre>