Last Updated: February 25, 2016
·
1.691K
· williamn

CakePHP routing configuration for multi-tenant application

$validTenant = '[a-z0-9-]+';
Router::connect('/a/:tenant', array('controller' => 'home'), array('tenant' => $validTenant));
Router::connect('/a/:tenant/:controller', array(), array('tenant' => $validTenant));
Router::connect('/a/:tenant/:controller/:action/*', array(), array('tenant' => $validTenant));