title: codeigniter controllers in sub-folders
body: <p>I'm designing a system where the uri's look as following</p>
  
  <pre><code>my-app.com/client-name/admin/foo
  my-app.com/client-name/admin/bar
  </code></pre>
  
  <p>Where client-name is variable. Obviously I want to put the admin controllers in a sub-folder to maintain my sanity. So my folders can look as following...</p>
  
  <pre><code>/application/controllers/admin/foo.php
  /application/controllers/admin/bar.php
  </code></pre>
  
  <p>Problem:</p>
  
  <p>From the docs:
  "Organizing Your Controllers into Sub-folders
  When using this feature the first segment of your URI must specify the folder."</p>
  
  <p>Is there anyway to get around this?</p>
  
  <p>Could I create an admin controller </p>
  
  <pre><code>/application/controllers/admin.php
  </code></pre>
  
  <p>And use the _remap function to manually load controllers from the subfolder?</p>
  
  <p>update:</p>
  
  <p>My routes look like this</p>
  
  <pre><code>// Admin Root
  $route['(:any)/admin'] = "admin/welcome";
  </code></pre>
  
  <p>Then before any controllers load I validate the first URI segment to make sure that client exists.</p>
  
  <p>All clients use the same controllers and routes.</p>