【发布时间】:2014-01-05 15:11:40
【问题描述】:
。 大家好,
我正在开发一个学校项目的网站。 最近我在 Biberbit.com 上购买了自己的网站空间并想上传我的网站。 当我上传它时,我在屏幕上看到以下错误:
Kohana_HTTP_Exception [ 404 ]: The requested URL / was not found on this server.
我的项目使用的是 Kohana 框架版本 3.3.1 我已经有了 .htaccess 文件,并且文件名/目录名都是小写的。 我使用的是默认路由:
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
最初我认为它可能是 bootstrap.php 文件中的 default_url,所以我将这些行更改为:
Kohana::init(array(
'base_url' => '/',
'index_file' => FALSE,
));
我在多个网站上寻找解决方案,但找不到适合我的解决方案。
谁能想到我可能会想念的东西?
我的链接也使用URL::site(),所以我不认为这是导致它的原因。
您可以在http://www.biberbit.com查看错误和/或网站
编辑: .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]
【问题讨论】:
-
你能添加 .htaccess 吗?
-
@kingkero 我想我发现了安装目录的 .htaccess 中有什么问题。
-
更改
RewriteBase后是否有效? -
@kingkero 不,它设置为“/”,但它似乎无法修复 404。仍然可以正确设置它。
-
一件事让我感到困惑:当我使用 FTP 客户端连接到服务器时,它会将我发送到 /,然后我转到 domain/biberbit.com/public_html,这是我的代码所在的位置.这无关紧要吗?
标签: php url http-status-code-404 kohana