You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got the same one probleme when trying to use plugin within prefix.
I written fallback and add my routes for my prefix but all page aren't accessibles.
Cakephp want a Controller as prefix name.
`
Router::prefix('dashboard', function ($routes) {
// Plugin do not work within prefix
// Plugin wants a controller named as prefix
$routes->connect('/', ['controller' => 'Articles', 'action' => 'index'], ['routeClass' => 'ADmad/I18n.I18nRoute']);
$routes->connect('/', ['controller' => 'Articles', 'action' => 'index']);
// All routes here will be prefixed with `/admin`
// And have the prefix => admin route element added.
$routes->fallbacks('ADmad/I18n.I18nRoute');
$routes->fallbacks('DashedRoute');
Router::prefix() and Router::plugin() are just shortcuts for scoping.
So using Router::prefix('opn', ...) you will end up with connected routes of style /opn/:lang/foo/bar not /:lang/opn/foo/bar as you expect. Same for Router::plugin().
So don't use those methods and directly connect required routes using $routes->connect() withing '/' scope.
FYI you can use bin/cake routes on command line to see all connected routes.
Hello,
I don't undestand how to do I18n Route when i have a prefix
When i try this
I've got Url like this ---> http://xxx.com/fr/opn/users/token so it's good in my mind
but "Opn" is consider as a controller and not as prefix.
Same issue if i do stuff like this :
Could you help me please with this ?
Best Regards,
The text was updated successfully, but these errors were encountered: