Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Kohana 404错误:未找到请求的URL_Php_Url_Http Status Code 404_Kohana - Fatal编程技术网

Php Kohana 404错误:未找到请求的URL

Php Kohana 404错误:未找到请求的URL,php,url,http-status-code-404,kohana,Php,Url,Http Status Code 404,Kohana,。 大家好, 我正在为一个学校项目制作一个网站。 最近我在Biberbit.com上购买了自己的网站空间,并想上传我的网站。 上传时,我在屏幕上看到以下错误: Kohana_HTTP_Exception [ 404 ]: The requested URL / was not found on this server. 我的项目使用Kohana框架版本3.3.1 我已经有了.htaccess文件,文件名/目录名都是小写的。 我使用的是默认路线: Route::set('default', '(

。 大家好,

我正在为一个学校项目制作一个网站。 最近我在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',
));
我已经在多个网站上寻找解决方案,但找不到适合我的解决方案。 谁能想到我可能错过的东西? 我还使用了
URL::site()
作为我的链接,所以我认为这不是原因

您可以通过以下网址查看错误和/或网站:

编辑: .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]
#启用URL重写
重新启动发动机
#安装目录
重写基/
#保护隐藏文件不被查看
命令拒绝,允许
全盘否定
#保护应用程序和系统文件不被查看
重写规则^(?:应用程序|模块|系统)\b.*index.php/$0[L]
#允许直接显示现有的任何文件或目录
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
#将所有其他URL重写为index.php/URL
重写规则。*index.php/$0[PT]

基本url设置错误,应该为空(因为您在web根目录上)。同样取决于您是否有Linux,文件名不能全部为小写,但在代码中使用它们的方式不同。因此,默认控制器为
Welcome.php
而不是
Welcome.php

Kohana_HTTP_异常[404]:在此服务器上找不到请求的URL/。
当Kohana找不到相应的操作方法来处理请求时,通常会引发异常

确保您有
Controller\u Welcome
类和
action\u index
方法


此外,您还可以检查异常回溯,并找到导致异常的确切原因。如果(!method_存在(…)块中,
中的
SYSPATH/classes/Kohana/Controller.php
文件中很可能会看到Exeption

奇怪的是,我最初尝试了空的base_url,所以它必须是文件名。我会检查一下,然后告诉你结果。文件url中的名称总是小写的,但在类名中它是Controller\u Welcome for Welcome.php。我更改了文件名以反映类名,并清空了base\u url字符串,但它仍然给我404。对不起,但是如果文件名正确并且正确设置了
base\u url
,它应该可以工作。你能添加.htaccess吗?@kingkero我想我在安装目录中发现了.htaccess中的错误。当你更改
RewriteBase
,它可以工作吗?@kingkero不,它设置为“/”,但似乎无法修复404。尽管如此,正确设置还是不错的。有一件事让我很困惑:当我用FTP客户端连接到服务器时,它会将我发送到/,然后我会转到domains/biberbit.com/public_html,这就是我的代码所在。这无关紧要吗?
# 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]