cakephp 3.0 - Cakephp3 prefix routing on specific controllers -


i'm trying set prefix routing on controllers want separate admin version seem able make work or nothing.

$routes->prefix('admin', function ($routes) {     $routes->connect('/:controller/:action/*', [], ['routeclass' => 'cake\routing\route\inflectedroute']); }); 

the above creates admin prefix on every controller such when within /admin/ links controller created html helper have admin prefix added them , when i'm redirected login prefixed /admin/. need create admin version of every controller or specify on every link prefix=>false.

i assumed like:

$routes->prefix('admin', function ($routes) {     $routes->connect('/projects/:action/*', ['controller' => 'projects'], ['routeclass' => 'cake\routing\route\inflectedroute']); }); 

but code when accessing page within /admin/projects error: error: route matching "array ( 'controller' => 'users', 'action' => 'login', 'prefix' => 'admin', 'plugin' => null, '_ext' => null, )" not found. if trying redirect me login, though if revert code page loads , have not been logged out.

thanks in advance help.

from talking colleague turns out i'm misunderstanding how prefix routing works. it's false concept connect controllers/routes prefix. controllers can accessed using prefix , need use links within app ensure user goes appropriate place - ie specify 'prefix'=>'false' if want leave 'admin' prefix.

cake automatically merge current prefix links if not specified.

with regards being directed admin version of login page. created admin login method redirects non-admin version.