title: Codeigniter HMVC and CMS
body: <p>I am using Codeigniter with the HMVC Modular extension and have a backend CMS area for managing website content. I am routing the base URL + "admin" (<a href="http://localhost/cms/admin" rel="nofollow noreferrer">http://localhost/cms/admin</a>) to controller methods with the prefix "admin_".</p>
  
  <pre>
  e.g. function admin_index() {...}
  </pre>
  
  <p>And here is my routing:</p>
  
  <pre>
  $route['admin/([a-zA-Z]+)/(:any)'] = "$1/admin_$2";
  $route['^admin/(:any)(/)?'] = "$1/admin_index";
  $route['^admin(/)?'] = "dashboard/admin_index";
  $route['admin/logout'] = "login/admin_logout";
  </pre>
  
  <p>With the HMVC it is not routing correctly now. Here is what happens:</p>
  
  <pre>
  URL: http://localhost/cms/admin/faqs
  Directory: modules/faqs/controllers/faqs - index method
  --
  here is where it breaks
  --
  URL: http://localhost/cms/admin/faqs/categories
  Directory: modules/faqs/controllers/faqs - categories method (does not exits)
  Desired: modules/faqs/controllers/categories - index method
  </pre>
  
  <p>How can I use HMVC while maintaining the "admin" are of the website?</p>