title: Subdirectory URL rewriting PHP
body: <p><strong>Setup</strong></p>
  
  <p>I have my file structure set up as so:</p>
  
  <pre><code>/root
     | 
     /api
        | 
        /Slim PHP framework
        index.php
     | 
     index.php
  </code></pre>
  
  <p>The <code>index.php</code> inside the Slim directory contains the routes required to retrieve the <code>JSON</code> data from a <code>Mongo</code> database. E.g.</p>
  
  <pre><code>$app-&gt;get('/users(/:id)', function($id = null) use ($app, $collection) {
       /* Do mongo search and echo json_encoded data back */
  });
  </code></pre>
  
  <p>I have an <code>.htaccess</code> file contains: which removes the <code>.php</code> extension from files under the root.</p>
  
  <pre><code>RewriteEngine on 
  RewriteCond %{REQUEST_FILENAME} !-d 
  RewriteCond %{REQUEST_FILENAME}\.php -f
  RewriteRule ^(.*)$ $1.php`
  </code></pre>
  
  <p><strong>Question</strong></p>
  
  <p>I can access my <code>JSON</code> data using url: <code>http://localhost:8888/root/api/index.php/users</code>.
  However, what I would like to do is access the data using the url: <code>http://localhost:8888/root/api/users</code></p>