1
well, I can’t create a route for a particular controller and there is always a 404 error when loading the page. In case I set this controller to default_controller the page is displayed normally.
Does anyone know what it might be? I haven’t changed anything in the . htaccess file
Config
$config['base_url'] = 'http://'.$_SERVER['HTTP_HOST'].'/CodeIgniter/core/';
$config['index_page'] = 'index.php';
Controller:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Utilizador extends CI_Controller {
function __construct(){
parent::__construct();
$this->load->library('session');
}
public function index(){
//print_r($this->Utilizador_model->teste());
echo "pppp";
}
}
?>
Routes:
$route['default_controller'] = 'pages';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;
$route['utilizador'] = 'utilizador';
File where I am calling the controller:
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-6 col-xs-12 col-md-offset-4 col-sm-offset-3">
<div class="bslf form">
<form action="<?= base_url('utilizador') ?>" method="post">
<h2 class="text-center">Login</h2>
<div class="form-group">
<input type="text" class="form-control" placeholder="Username" required="required">
</div>
<div class="form-group">
<input type="password" class="form-control" placeholder="Password" required="required">
</div>
<div class="form-group clearfix">
<button type="submit" class="btn btn-primary pull-right">Log in</button>
</div>
</form>
</div>
</div>
</div>
</div>