开发者

Kohana 3 routing error with default controller in controller subdirectory

I am receiving "HTTP_Exception_404 [ 404 ]: The requested URL admin/index, controller_admin was not found on this server." when I try to access www.site.com/admin. www.site.com/admin/home works fine.

I am assuming that it should find the Controller_Admin_Home controller but it seems my admin route is being ignored in the default case. Any ideas?

My Routing rules:

Route::set('admin', 'admin/(<controller>(/<action>(/<id>)))')
    ->defaults(array(
        'directory' => 'admin',
        'controller' => 'home',
        'action' => 'index',
));

Route::set('default', '(<controller>(/开发者_Go百科<action>(/<id>)))(/<format>)', array('format'=>'html|json','id'=>'[0-9]+'))
    ->defaults(array(
    'controller' => 'home',
    'action' => 'index',
    'id' => null,
    'format' => null,
));


"The default case" means what excactly?

Your admin route matches everything that starts with "admin/" and had a maximum of three adittional segments. Notice the slash?

Move the slash one position to the right and it will be as optional as the controller parameter.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜