1
I was following the Codeigniter startup tutorial when I came across a problem with routes.
the route file is with the following routes:
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['news/create'] = 'news/create';
$route['news/(:any)'] = 'news/view/$1';
$route['news'] = 'news';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';
An example of a controller could be Pages
:
class Pages extends CI_Controller
{
public function view($page = 'home')
{
if ( ! file_exists(APPPATH . 'views/pages/' . $page . '.php'))
show_404();
$data['title'] = ucfirst($page);
$this->load->view('templates/header', $data);
$this->load->view('pages/'.$page, $data);
$this->load->view('templates/footer', $data);
}
}
When called by default_controller it runs normally, but when I try to enter a different route a Not Found of Apache.
I’ve already checked if all classes are capitalized, the rewrite module is active, and in config.php I just changed the:
$config['base_url'] = 'http://estudo.local/ci/';
The .htaccess:
<IfModule authz_core_module>
Require all denied
</IfModule>
<IfModule !authz_core_module>
Deny from all
</IfModule>
What would be the problem?
How’s the . htaccess file?
– Yure Pereira
Didn’t forget to put it on?
– Yure Pereira
I put him in the question, I didn’t change anything in him because in the tutorial it didn’t say anything about him so I trusted for his an official tutorial.
– Leonardo