title: Additional URI segment before Codeigniter controller
body: <p>I'm making this little project in Codeigniter and I need to have one additional segment before controller.<br>
  The default Codeigniter URL is:  </p>
  
  <pre><code>base_url/controller/function/parameter1/../parametern  
  </code></pre>
  
  <p>What I need is:  </p>
  
  <pre><code>base_url/something/controller/function/parameter1/../parametern 
  </code></pre>
  
  <p>Where "something" is a name that user creates so I cant create a subfolder in controllers folder as suggested in other topics because its dynamic and each user chooses what he likes.  </p>
  
  <p>Basically what I need is that it like ignores that segment (I would catch that segment in a hook, extend CI_controller or something like that and validate it), for example if I write <strong>base_url/stackoverflow-rocks/home/function</strong>, <strong>base_url/asd-whatever/home/function</strong> Codeigniter would look at it like <strong>base_url/home/function</strong></p>
  
  <p>I have also looked at <a href="https://stackoverflow.com/questions/8233833/passing-variables-before-controller-uri-segment-in-codeigniter">Passing variables before controller URI segment in CodeIgniter</a> question, its almost the same as mine but the suggested answer didn't work.<br>
  I used <code>$route['(:any)/(:any)'] = '$2';</code> which works if the url is base_url/whatever/home, but if the url is base_url/whatever/home/function or base_url/whatever/home/function/param1/../paramn it doesn't, the workaround for this is to write:   </p>
  
  <pre><code>$route['(:any)/(:any)'] = '$2';  
  $route['(:any)/(:any)/(:any)'] = '$2/$3';  
  ...  
  $route['(:any)/../(:any)'] = '$2/../$n'  
  </code></pre>
  
  <p>which is easy, but seems a bit lame, and it will only work if I have from 2 to n segments in url. I also tried to mix it with regular expressions, like:  </p>
  
  <pre><code>$route['(:any)/(.*)'] = '$2'
  </code></pre>
  
  <p>But it works just like the previous one, (.*) is just one segment but not the whole url... 
  Is there some way to just write<br>
  <code>$route['(:any)/rest of the url'] = 'rest of the url';</code>?<br>
  I also tried using .htaccess:  </p>
  
  <pre><code>RewriteRule ([^/]*)/(.*) inedx.php?/$2  
  </code></pre>
  
  <p>or</p>
  
  <pre><code>RewriteRule (.*)/(.*) index.php?/$2
  </code></pre>
  
  <p>But it didn't work because $2 referenced to the first part, for example if I write:<br>
  base_url/one/two it rewrites it to base_url/index.php?/one. 
  But if I use:</p>
  
  <pre><code>RewriteRule (.*)/(.*) index.php?/$1/test/$2
  </code></pre>
  
  <p>it references as it should, for example base_url/one/two => base_url/index.php?/one/test/two, so $1 = one and $2 = two, as it should be.</p>
  
  <p>Quite a long question but I hope someone can help, thanks!</p>