Route results in 404 Not Found

1

I was following the CodeIgniter startup tutorial when I came across a problem with routes.

The route file has 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 controller might 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 is displayed.

I have already checked that all classes have the files initialized in capital letters, the rewrite module is active, and in config.php I only changed the:

$config['base_url'] = 'http://estudo.local/ci/';

.htaccess :

<IfModule authz_core_module>
    Require all denied
</IfModule>
<IfModule !authz_core_module>
    Deny from all
</IfModule>

What would be the problem?

    
asked by anonymous 23.07.2016 / 04:05

1 answer

2

Puts the .htaccess file as follows:

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