kohana 3.3中的URL,index.php的问题


URL in kohana 3.3, problems with index.php

我是kohana的新手,几天来,我一直无法使用index.php在控制器中执行操作。我总是收到错误"在服务器上找不到请求的url"下面是我的.htaccess文件

# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /njorku.com/
# Protect application and system files from being viewed
RewriteRule ^(application|modules|system) - [F,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,L]

这是我的控制器类

<?php defined ('SYSPATH') or die('No direct script access');
class Controller_Ask extends Controller {
    public function action_index (){
        $quests = ORM::factory('asknjorku_question')->order_by('question_id','desc')->find_all();   
        $view = View::factory('/en/asknjorku/index')->bind('quests',$quests);
        $this->request->response = $view;
    }
}
?>

当我去http://localhost/njorku.com/index.php/ask/index它有效,但是http://localhost/njorku.com/ask/index不起作用

为什么会这样,请帮帮我?

除了.htaccess,您可能还需要修改bootstrap.php文件,尤其是Kohana::init()调用:

Kohana::init(array(
    'base_url'   => '/njorku.com/',
    'index_file' => FALSE,
));