Search code examples
.htaccesshttp-status-code-404kohana-3custom-routes

Kohana 3.3.2 Controller in subfolder


I'm starting with Kohana and i don't understand why i have this error ...

 Kohana_HTTP_Exception [ 404 ]: The requested URL api/v1/welcome was not found on this server.

 SYSPATH/classes/Kohana/Request/Client/Internal.php [ 89 ]

 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);

My .htaccess

# Turn on URL rewriting
RewriteEngine On

# Installation directory
RewriteBase /

# Protect hidden files from being viewed
<Files .*>
    Order Deny,Allow
    Deny From All
</Files>

# Protect application and system files from being viewed
RewriteRule ^(?:application|modules|system)\b.* index.php/$0 [L]

# Allow any files or directories that exist to be displayed directly
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all other URLs to index.php/URL
RewriteRule .* index.php/$0 [PT]

My Route

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

My Controller: Controller/api/v1/Welcome.php

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

class Controller_Api_v1_Welcome extends Controller {

    public function action_index()
    {
        $this->response->body('hello, world!');
    }
} // End Welcome

Am i missing something ??? Why the class_exist on my controller class return FALSE ???


Solution

  • Kohana 3.3.2 => The entire code is now case sensitive

    Route::set('api','api/v1(/<controller>(/<id>)(/<custom>))'
    )->defaults(
        array(
            'directory' =>'Api/V1',
            'controller' => 'Welcome',
            'id'         => FALSE,
            'action'     => 'index',
        )
    );