首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >找不到Kohana URL

找不到Kohana URL
EN

Stack Overflow用户
提问于 2012-12-07 18:06:56
回答 4查看 8K关注 0票数 1

您好,我的kohana代码有问题,它给我带来了同样的错误,我认为是htaccess或bootstrap有问题

它安装在我的根目录下,而不是作为一个子文件夹。

代码语言:javascript
复制
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代码

代码语言:javascript
复制
# 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设置为'/‘

EN

回答 4

Stack Overflow用户

发布于 2013-03-12 05:12:34

当我将kohana从本地主机迁移到linux主机时,我也遇到了同样的问题。

尝试用大写字母重命名您的控制器文件。在bootstrap路由中,保留小写字母。

这对我有帮助。

票数 4
EN

Stack Overflow用户

发布于 2012-12-13 02:33:45

请尝试并尽可能多地发布bootstrap.php文件。很可能您没有默认的根集。

在文件中搜索代码块,如下所示

代码语言:javascript
复制
Route::set('default', '(<controller>(/<action>(/<id>)))')
    ->defaults(array(
        'controller' => 'default',
        'action'     => 'index',
    ));

关键字是Route::set('default', '(<controller>(/<action>(/<id>)))')

您的应用程序托管在哪里?它是在www上还是在www的子文件夹中?

票数 1
EN

Stack Overflow用户

发布于 2013-07-06 02:41:53

您看到的是当您没有使用set up your environment to run for the first time to use clean urls时抛出的错误。执行以下操作:

  1. 进入您的.htaccess文件,并为RewriteBase设置正确的路径(如果您的本地主机路径为localhost/my/site,则您的htaccess应为:

RewriteBase /localhost/my/site/

(确保将文件重命名为.htaccess )

  • 进入bootstrap.php文件,并确保Kohana::init具有:

在其array.

  • Inside 'base_url' => '/localhost/my/site/' /application/classes/Controller/目录中,添加控制器文件名以使第一个字母为大写(即Welcome.php),并在控制器内部确保控制器内容写入正确。

/application/classes/Controller/Welcome.php

这是解决问题的良好开端。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13760897

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档