1

こんにちは私は私のkohanaコードに問題があり、同じエラーが発生し、htaccessまたはブートストラップに問題があると思います

サブフォルダとしてではなく、ルートディレクトリにインストールされます。

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

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

74          if ( ! class_exists($prefix.$controller))
75          {
76              throw HTTP_Exception::factory(404,
77                  'The requested URL :uri was not found on this server.',
78                  array(':uri' => $request->uri())
79              )->request($request);
80          }
81 
82          // Load the controller using reflection
83          $class = new ReflectionClass($prefix.$controller);
84 

    SYSPATH/classes/Kohana/Request/Client.php [ 114 ] » Kohana_Request_Client_Internal->execute_request(arguments)

    SYSPATH/classes/Kohana/Request.php [ 990 ] » Kohana_Request_Client->execute(arguments)

    DOCROOT/index.php [ 109 ] » Kohana_Request->execute() 

これが私の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]

#-SetEnv KOHANA_ENV "production"

ブートストラップで、site_urlを「/」に設定しました

4

4 に答える 4

4

kohana を localhost から Linux ホスティングに移動したときにも同じ問題が発生しました。

コントローラ ファイルの名前を大文字に変更してみてください。ブートストラップ ルートでは、小文字を保持します。

それは私を助けました。

于 2013-03-11T21:12:34.403 に答える
1

できるだけ多くの bootstrap.php ファイルを投稿してみてください。デフォルトのルート セットがない可能性があります。

次のようなコード ブロックをファイル内で検索します。

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

というキーワードはRoute::set('default', '(<controller>(/<action>(/<id>)))')

アプリケーションはどこでホストされていますか? それは www にありますか、それとも www のサブフォルダーにありますか?

于 2012-12-12T18:33:45.163 に答える
0

コントローラーが見つからないため、この例外がスローされました。デフォルトでは、'/' URI は のメソッドaction_index()を呼び出すことを意味しController_Welcomeます。bootstrap.php、を参照してくださいRoute::set('default', ...)

次のいずれかの理由が考えられると思います。

  1. デフォルト ルートがあり、application/classes/Controller/Welcome.php削除されました。
  2. Kohana のバージョンを v3.3 にアップグレードする際に、applicationフォルダーを新しいものに置き換えていません。したがって、application/classes/controller/welcome.php代わりに がありapplication/classes/Controller/Welcome.phpます。
  3. 存在しないコントローラーでデフォルト ルートを変更しました。Kohana v3.3 には、新しいファイル/クラスの命名規則があることに注意してください。
于 2012-12-07T18:15:04.987 に答える