在 Routes.php 中我配置了大部分路由规则:
...
$routes->get('{locale}/contenuto/(:any)', 'Contenuto::index/$1');
$routes->get('contenuto/(:any)', 'Contenuto::index/$1');
$routes->get('{locale}/cerca', 'Cerca::index/$1');
$routes->get('cerca', 'Cerca::index/$1');
...
这些网址有效:
http://localhost:8080/it/cerca
http://localhost:8080/it/contenuto/content_slug
http://localhost:8080/contenuto/content_slug
并显示正确的视图。 此规则不起作用:
http://localhost:8080/cerca
并重定向到默认 URL。 Contenuto 控制器和 Cerca 控制器工作正常。 有没有理由因为它不起作用? 有没有办法理解为什么它不起作用?