title: Advanced routing to check multiple controllers in Codeigniter
body: <p>I'm trying to find a way to route URL's to their appropriate controller when the URL's are all off the root domain.</p>
  
  <p>For example:</p>
  
  <ul>
  <li><code>site.com/@username</code> - should go to Users controller</li>
  <li><code>site.com/uk/london</code> - should go to Countries controller</li>
  <li><code>site.com/fr/paris</code> - should go to Countries controller</li>
  <li><code>site.com/bobs-farm</code> - should go to Farms controller</li>
  </ul>
  
  <p>...and so on.</p>
  
  <p>It's easy enough with says <code>site.com/users/username</code> but that's no good in this case.</p>
  
  <p>What I need to do is pass the params to one controller, check if it's a match and if so, deal with - else pass it to the next controller and see if it fits there, and so on.</p>
  
  <p>I could force everything into one giant catch-all controller but there's likely to be too much going on and it'll be way too unwieldy. Is there a way of doing this I can't figure out?</p>