Codeigniter中找不到404页面错误 [英] 404 page not found error in Codeigniter

查看:80
本文介绍了Codeigniter中找不到404页面错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Codeigniter框架的新手,我尝试制作第一个程序,但收到 404页面未找到错误

I am new to the codeigniter framework and I have tried to make my first program but received a 404 page not found error

这是我的根目录 Codeigniter 和目录结构

This is my root directory Codeigniter and my directory structure

我的源文件夹包含.htaccess文件,该文件包含以下代码

My source folder contains the .htaccess file containing the following code

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

Home.php

    class  Home extends CI_Controller{
    public function index(){
        $this->load->view('View');
    }
}

view.php

echo "HI this is my first codeigniter program";

我尝试了以下网址 http:// localhost / Codeigniter / 但我
遇到404错误,但是即使我的实际根文件夹是 http:// localhost / Codeigniter / home 也会加载正确的结果是Codeigniter

I have tried the following url http://localhost/Codeigniter/ but I get a 404 error, however http://localhost/Codeigniter/home loads the correct result even though my actual root folder is Codeigniter

如何解决此问题?

推荐答案

更改路线文件在以下路径中:-

Change route file in this following path:-

CodeIgniter/application/config/routes.php

$route['default_controller'] = 'required_controller';

然后只有您可以访问以下网址

Then only you can access the following url

http://localhost/Codeigniter/

这篇关于Codeigniter中找不到404页面错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆