Basic routing problem with plugins

Hey there!
I am pretty new to CakePHP and after I spent so many hours on this issue without an answer I hope somebody can help me here.

I want to call a view of my plugin from another view of my main page by clicking on a link which looks like this:

<li><?= $this->Html->link(__('Postal Services'), ['plugin' => 'MailCalculator', 'contoller' => 'postal_services', 'action' => 'index']) ?></li>

But after I click the link I always get the same exception:

Error: Create the class PagesController below in file: /Applications/MAMP/htdocs/rich-code/plugins/MailCalculator/src/Controller/PagesController.php

And the address line in my browser looks like this:

the code in my config/routes.php:

Router::scope('/', function (RouteBuilder $routes) {

    $routes->connect('/', ['controller' => 'Pages', 'action' => 'home']);


(I’m still not sure if this is enough, but all of my PagesController’s actions are perfectly accessible from my homepage so far. Somehow it builds the path automatically, e.g. http://localhost/rich-code/pages/about when I call the about() action without me being forced to add a routes->connect rule like $routes->connect(’/pages/*’, …)

And the code in my plugin’s config/routes.php:
use Cake\Routing\Router;

Router::plugin('MailCalculator', function ($routes) {

Router::scope('/mail_calculator', ['plugin' => 'MailCalculator'], function ($routes) {
    $routes->connect('/insurance', ['controller' => 'PostalServices']);
    $routes->connect('/insurance/:action/*', ['controller' => 'PostalServices']);

I tried millions of ways to handle it but no matter what I do, CakePHP insists on appending the pages bit to every of my paths: pages?contoller after the plugin name

Could anybody guide me through here a bit because I’m completely lost

// would be ‘controller’

1 Like

Thank you so much!