【问题标题】:CakePHP 3: Plugin routing without a slash at the end?CakePHP 3:最后没有斜线的插件路由?
【发布时间】:2016-03-13 07:06:57
【问题描述】:

管理插件/PagesController 方法:

  • 首页
  • 索引
  • 添加
  • ..

移除了默认的显示方式。

问题,如果我尝试重定向到 mysite.com/admin/webroot/pages strong> 和错误信息

错误:找不到 WebrootController。

对于所有其他没有斜线的控制器 url 都可以。

管理插件/配置中的路由器:

Router::plugin('Admin', function ($routes) {
    $routes->connect('/login', ['controller' => 'Users', 'action' => 'login']);
    $routes->connect('/new-password', ['controller' => 'Users', 'action' => 'newPassword']);
    $routes->connect('/reset-password', ['controller' => 'Users', 'action' => 'resetPassword']);
    //$routes->connect('/pages', ['controller' => 'Pages', 'action' => 'index']);
    $routes->connect('/', ['controller' => 'Pages', 'action' => 'home']);
    $routes->fallbacks('DashedRoute');
});

【问题讨论】:

  • 您的 webroot 目录中是否有一个名为“page”的文件夹?
  • 不,只有标准文件夹
  • 对我来说听起来像是一个 Web 服务器配置问题。例如在 Apache 中,它认为没有 -d 或 -f 开关它是一个文件或文件夹。
  • 尝试将Options -MultiViews 添加到您的webroot/.htaccess

标签: cakephp cakephp-3.0 cakephp-3.1


【解决方案1】:

This thread on github 可以帮助你。

据我所知,唯一的方法是将文档根设置为 /webroot

对于任何有兴趣在 cPanel 上更改主域的文档根目录的人:check here

【讨论】:

    猜你喜欢
    • 2013-10-09
    • 1970-01-01
    • 1970-01-01
    • 2017-01-07
    • 1970-01-01
    • 2012-04-09
    • 2012-12-03
    • 1970-01-01
    • 2016-09-09
    相关资源
    最近更新 更多