Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/.htaccess/6.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 控制器/方法路由上的CodeIgniter 404错误_Php_.htaccess_Codeigniter - Fatal编程技术网

Php 控制器/方法路由上的CodeIgniter 404错误

Php 控制器/方法路由上的CodeIgniter 404错误,php,.htaccess,codeigniter,Php,.htaccess,Codeigniter,我现在面临一个关于CodeIgniter的小问题 我有以下文件: applications/controllers/home/entretiens.php 看起来是这样的: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Entretiens extends CI_Controller { public function index() {

我现在面临一个关于CodeIgniter的小问题

我有以下文件:

applications/controllers/home/entretiens.php
看起来是这样的:

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Entretiens extends CI_Controller
{
    public function index()
    {
        if($this->session->userdata('logged_in'))
        {
             $data['page'] = "entretiens";
             $session_data = $this->session->userdata('logged_in');
             $data['prenom'] = $session_data['prenom'];
             $this->load->model("Entretiens_model");
             $data['entretiens'] = $this->Entretiens_model->getAllEntretiens($session_data['id']);
             $data['main_content'] = 'home/entretiens_view.php';
             $this->load->template('entretiens_view', $data);
        }
        else
        {
            //If no session, redirect to login page
            redirect('home/login', 'refresh');
        }
    }

    public function ajouter()
    {
        echo 'Test';
    }
}

?>
还有
config.php
(好吧,有趣的部分):

和我的
.htaccess

RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond $1 !^(index\.php|css|images|robots\.txt)
RewriteRule ^(.*)$ ./index.php/$1 [L]

(此问题发生在所有控制器上,而不仅仅是
入口

更改
routes.php中的相关行,如下所示:

$route[“entrieens(.*)]]=“home/entrieens$1”;

这将被视为通配符,在
entertiens
之后的所有内容都将传递到
home/entertiens

中,效果非常好!感谢您的帮助!
$config['base_url'] = 'http://dev.hinsolite.com/';
$config['index_page'] = '';
$config['uri_protocol'] = 'AUTO';
RewriteEngine on
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond $1 !^(index\.php|css|images|robots\.txt)
RewriteRule ^(.*)$ ./index.php/$1 [L]