Search code examples
php.htaccesscodeigniterimplementationcentos5

Unable to locate requested file codeigniter centos


I can't load a view on my CentOS Server, i edited htaccess file to remove the index.php on the url. this is the code of controller to load the view:

<?php

defined('BASEPATH') OR exit('No direct script access allowed');

 class Login extends CI_Controller {

public function __construct() {
    parent::__construct();
}

public function index() {
    $Alias = $this->input->post('UserAlias');
    $Password = $this->input->post('UserPass');
    if ($Alias != null && $Password != null) {
        $this->load->model('Usuarios');
        $UserData = $this->Usuarios->Login($Alias, $Password);
        if ($UserData != null) {
            $usuario_data = array('nombreUser' => $UserData->Nombre,'ipUser' => $this->input->ip_address(),'logueado' => TRUE, 'indices' => $UserData->IdRol, 'sucursal' => $UserData->IdAgency, 'usaurio' => $UserData->IdUsuario);
            $this->session->set_userdata($usuario_data);
            $this->load->helper('url');
            if ($UserData->IdRol == 2) {
                Redirect('Orders');
            }
            if ($UserData->IdRol == 3) {
                Redirect('Deliveries');
            }
            if ($UserData->IdRol == 1) {
                Redirect('Administration');
            }
        } else {
            $data['ErrorLogin'] = '<div id="login_error" class="alert alert-danger" role="alert"><button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button><strong>Error!</strong> Usuario o contraseña no validos. </div>';
            $this->load->view('Login', $data);
        }
    } else {
        $data['ErrorLogin'] ='';
        $this->load->view('Login', $data);
    }
}

}

Locally everything works perfectly, when i clone the project in my server i get this problem. if it serves them I leave the contents of my htacces file:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|php|script|styles|js|css)
RewriteRule ^(.*)$ /index.php/$1 [L]

if you need more information I can provide it, any suggestion is welcome, thanks.


Solution

  • Hard to say. My inital guess would be the capitalization of the view 'Login.php'. Your local filesystem may be case insensitive while CentOS may be case sensitive.