title: Codeigniter URL redirection and routing
body: <p>I am trying to redirect URL's with Codeighiter routing. I could not write routing for the following.</p>
  
  <p>If the URL comes with <code>/api/some/some</code> I want to redirect it to <code>api/some/some</code>, otherwise I want to redirect the URL to <code>/home/index</code>.</p>
  
  <p>i.e if any URL starts with <code>api/</code> i don't want to change that URL other wise i want to redirect it to default controller <code>home/index</code></p>
  
  <p>What i tried is mapping the codeigniter URL routing.</p>
  
  <pre><code>$route['api/(:any)'] = 'api/(:any)';
  
  $route['(:any)'] = 'home/index/';
  </code></pre>
  
  <p>I am trying with codeigniter URL routing technique but i am not able to achieve this. </p>
  
  <p>Is this is the way to redirect URL's at codeigniter level with out touching server side redirection or is there any better approach to do this?</p>