CakePHP Route Prefix

I have 3 different layouts for my application related to different pieces of content. I would like to define my urls so that they are part in the beginning. "Mypage.com/part1/controller / ...". I do not know how to change routes to make this possible.

PS I do not need the usual routing of the prefix where the names of my actions with the controller change.

0
source share
2 answers

read below url

For CakePHP 2.x http://book.cakephp.org/2.0/en/development/routing.html#prefix-routing

For CakePHP 1.x http://bakery.cakephp.org/articles/Frank/2009/11/02/cakephp-s-routing-explained

or

Configure::write('Routing.prefixes', array('admin', 'manager'));

$this->connect("/{$prefix}/:plugin/:controller", array('action' => 'index', 'prefix' => $prefix, $prefix => true));
$this->connect("/{$prefix}/:plugin/:controller/:action/*", array('prefix' => $prefix, $prefix => true));
Router::connect("/{$prefix}/:controller", array('action' => 'index', 'prefix' => $prefix, $prefix => true));
Router::connect("/{$prefix}/:controller/:action/*", array('prefix' => $prefix, $prefix => true));
0
source

cakephp

cakephp 2.x .

  • /Config/core.php Configure:: write ('Routing.prefixes', array ('admin', 'manager'));
  • /Config/routes.php
  • Router:: ( "/: ", ( '' = > '', '' = > ));
  • Router:: ( "/: /: /*", ( '' = > ));
  • :: ( "/: ", ( '' = > '', '' = > ));
  • Router:: ( "/: /: ", ( '' = > ));

. http://book.cakephp.org/2.0/en/development/routing.html http://miftyisbored.com/complete-tutorial-admin-routing-cakephp/

0

Source: https://habr.com/ru/post/1526080/


All Articles