简体   繁体   中英

Kohana 3.3 routing to subdirectory

I'm new to Kohana and am stuck with routing to a subdirectory, It keeps giving me a url not found on server.

In the bootstrap.php I have this Route defined:

Route::set('store', 'store(/<action>)')
    ->defaults(array(
        'directory'  => 'store',
        'controller' => 'main',
        'action'     => 'index',
    ));

the store controller is stored in application/classes/Controller/Store/Main.php

To test it the controller is only returning some text to the page:

<?php defined('SYSPATH') or die('No direct script access.');

class Controller_Store_Main extends Controller
{
    public function action_index()
    {
        $this->response->body('Store Main Page');
    }
}

The same works for me.

  1. What Kohana version do you use? This example is for 3.3 only.
  2. Your route must be defined before default route.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM