Я использую codeigniter 3. Я создал простой контроллер, и когда я пытаюсь получить доступ к контроллеру, я получаю ошибку 404.codeigniter не обнаруживает никаких контроллеров
мой контроллер
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class home extends CI_Controller {
/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
echo "Working fine";
$this->load->view('comman/header.php');
$this->load->view('home/home.php');
}
}
конфигурационный файл
$config['base_url'] = 'http://localhost/annaiplan/';
$config['index_page'] = 'index.php';
$config['url_suffix'] = '';
.htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteBase /annaiplan
RewriteCond $1 !^(index\\.php|resources|robots\\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
при попытке доступа приложение получает ошибку 404.
http://localhost/annaiplan/home/
попробовать URL, как это: HTTP: //localhost/annaiplan/index.php/home/ –
@NirajKarmick, что, как она работает. –
Вы можете проверить [это] (https://www.google.co.in/search?q=how%20to%20remove%20index.php%20in%20codeigniter&oq=how%20to%20remove%20index.php%20&ie= UTF-8 & AQS = chrome.0.0j69i57j0l4.13320j0j7 & SourceId = хром мгновенный & ион = 1 & БАВ = on.2, or.r_cp. & BVM = bv.108194040, d.dGY & BIW = 1360 & БиГ = 659 & DPR = 1 & ECH = 1 & фунтов на квадратный дюйм = ngZQVr6ZG8jLmAXI-p34Bw.1448085151548.3 & е = ngZQVr6ZG8jLmAXI-p34Bw & emsg = NCSR & noj = 1) для удаления 'index.php' из url –