title: Codeigniter dynamic routes
body: <p>In my CI application I have a few controllers to handle different user-type functions:</p>
  
  <ol>
  <li>CA </li>
  <li>CD  </li>
  <li>DV</li>
  <li>CSC</li>
  <li>CB</li>
  </ol>
  
  <p>So currently when someone logs in, he is redirected by his role to (example) : <code>localhost/CA</code> or <code>localhost/CD</code> etc..</p>
  
  <p>I need to rewrite the routes to redirect everything depending on his role:</p>
  
  <p><code>$route['(:any)'] = 'CA/$1';</code>   (CA should not be hardcoded)</p>
  
  <ul>
  <li>The rule should also be removed when using the login Controller (by filtering some url's)</li>
  </ul>
  
  <p>Can anyone show me how to hook the rules after login? and also how to use a regexp to filter some url on which to apply the rules? </p>
  
  <pre><code>$route['^((?!auth/).)*$'] = '$1';
  </code></pre>
  
  <p>What other way would be to achieve this? .htaccess is out of the question since I need some data logic to create the routes. </p>