Kohana子目录控制器(在此服务器上找不到请求的URL:uri.)


Kohana subdirectory controllers (The requested URL :uri was not found on this server.)

尝试调用浏览器中controller/api/v1/文件夹中的控制器。它在本地主机上正常工作,但在转移到服务器后,我收到了一个kohana错误

if ( ! class_exists($prefix.$controller))
        {
            throw HTTP_Exception::factory(404,
                'The requested URL :uri was not found on this server.',
                array(':uri' => $request->uri())                )->request($request);
        }
        // Load the controller using reflection
        $class = new ReflectionClass($prefix.$controller);

初始化:

Kohana::init(array(
'base_url'   => '/',
'index_file' => FALSE,

));

以下是我的路线:

Route::set('api', 'api/v1(/<controller>(/<action>(/<id>)))')
->defaults(array(
    'directory' => 'api/v1',
    'controller' => 'admin',
    'action'     => 'index',
));
Route::set('subsource', 'api/v1/<controller>(/<id>(/<action>))')
->defaults(array(
    'directory' => 'api/v1',
    'controller' => 'admin',
    'action'     => 'index',
));
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
    'controller' => 'welcome',
    'action'     => 'index',
));

控制器名称以Controller_Api_V1_ 开头

/Controllers/文件夹中的控制器工作正常。

如果我理解你的意思,你需要一个新的external请求。以下是文档:请求