【发布时间】:2013-10-26 09:14:37
【问题描述】:
我一直在谷歌上搜索解决方案或可以将我引导到部署我的 Kohana 3.3 站点的解决方案,但无济于事。
我对如何在 Kohana 中进行路由工作感到困惑,我将 bootstrap.php 文件中的默认路由保持不变。这里:
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
我正在使用免费的网络托管和子域,这是我的 URL:http://atosoft.neq3.com/。上面的路线输出“你好,世界”就好了。
但是当我想去我的管理页面时,我在这里得到一个错误 500:http://atosoft.neq3.com/admin。如何设置我的路线以使所有控制器都可以使用?
我的控制器和模型中没有子目录,只是在我的视图中。
这是我的文件夹结构:
/Controller
- Admin.php
- Courses.php
- Exams.php
- Questions.php
- Semester.php
- User.php
- Welcome.php
控制器/admin.php
class Controller_Admin extends Controller_Template {
public $template = 'admin_template';
public function action_index() {
// User authentication
$user = Auth::instance()->get_user();
if(Auth::instance()->logged_in()) {
// Display Dashboard here
$dashboard = View::factory('admin/index');
$this->template->user = $user;
$this->template->content = $dashboard;
} else {
HTTP::redirect('user/login');
}
}
}
.htaccess
# Turn on URL rewriting
RewriteEngine On
# Installation directory
RewriteBase /atosoft.neq3.com/
# 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]
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]
RewriteRule .* index.php [PT]
【问题讨论】:
-
您需要找出通用“500”错误的实际含义 - 它会在您的日志文件中。
-
我查看了 Kohana 的 LOG 文件夹,但其中没有任何内容可以解释问题,也没有任何记录在当前日期。
-
试试你的 Apache/PHP 日志
:) -
日志是否可能存储在服务器的其他位置?
-
好的,我刚才试过了,免费服务不允许我访问日志