title: Codeigniter + Lumen Framework - htaccess redirect certain path to specific folder
body: <p>I have a CodeIgniter project and I recently added a Laravel Lumen API, so the folder structure is the following</p>
  <pre><code>Project
   - api/
   - application/
   - public/
   - system/
   - .htaccess
   - index.php
  </code></pre>
  <p>Inside the <code>api/</code> folder resides the Lumen framework. Locally it's working perfectly, by accessing the url <code>localhost/example.com/api/test</code> it returns 200 HTTP code.</p>
  <p><code>.htaccess</code> codeigniter root folder:</p>
  <pre><code>Options -Indexes
  Options +FollowSymLinks
  
  # Set the default file for indexes
  DirectoryIndex index.php
  
  &lt;IfModule mod_rewrite.c&gt;
  
      RewriteEngine on
      
      RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
      RewriteRule ^(.*)$ https://example.com/$1 [R=301,L]
  
      RewriteCond %{HTTPS} !=on
      RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [QSA,R,L]
      
      RewriteCond $1 !^(index\.php|public|robots\.txt)
      RewriteCond $1 !^([^\..]+\.php|robots\.txt|sitemap\.xml)
  
      RewriteRule ^(.*)$ index.php?/$1 [L]
  
  &lt;/IfModule&gt;
  
  &lt;IfModule !mod_rewrite.c&gt;
  
      # If we don't have mod_rewrite installed, all 404's
      # can be sent to index.php, and everything works as normal.
  
      ErrorDocument 404 index.php
  
  &lt;/IfModule&gt;
  </code></pre>
  <p><code>.htaccess</code> lumen api folder:</p>
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      &lt;IfModule mod_negotiation.c&gt;
          Options -MultiViews -Indexes
      &lt;/IfModule&gt;
  
      RewriteEngine On
  
      # Handle Authorization Header
      RewriteCond %{HTTP:Authorization} .
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  
      # Redirect Trailing Slashes If Not A Folder...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_URI} (.+)/$
      RewriteRule ^ %1 [L,R=301]
  
      # Handle Front Controller...
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule ^ index.php [L]
  &lt;/IfModule&gt;
  
  &lt;Files .env&gt;
      Order allow,deny
      Deny from all
  &lt;/Files&gt;
  </code></pre>
  <p>The errors:</p>
  <ul>
  <li>By accessing <code>example.com/api/test</code> it returns 404 HTTP code <strong>by codeigniter</strong></li>
  <li>By accessing <code>example.com/api</code> it returns 404 HTTP code <strong>by lumen</strong></li>
  </ul>