I have a new controller in a module created with HMVC (admin), but i tried also without HMVC and the same issue. I am trying to pass a variable to index or another method from controller but when i access it i receive 404 error, not found. I am new to Codeigniter. I am trying to do resolve this since yesterday, please help me :) Thank you!
Route:
$route['default_controller'] = 'pages/view/home'; -- working
$route['(:any)'] = "pages/view/$1"; -- working
$route['404_override'] = ''; -- working
$route['admin'] = 'admin/index'; -- working
$route['admin/list'] = 'admin/list_pages/index'; -- working
$route['admin/edit/(:any)'] = 'admin/edit/index/$1'; -- this is the problem, the other rules are working
HTACCESS:
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
Controller:
class Edit extends CI_Controller{
function __construct() {
parent::__construct();
$this->load->model('pages_model');
}
function index($id = 0){
$data['page'] = $this->pages_model->get_pages_by_id($id);
$this->load->view('header', $data);
$this->load->view('edit', $data);
$this->load->view('footer', $data);
}
}
Config:
$config['base_url'] = '';
$config['index_page'] = 'index.php?';
$config['uri_protocol'] = 'QUERY_STRING';