php - CodeIgniter project not work on Linux-based remote server -
i developed project codeigniter on windows xampp works. not work on linux-based remote server.
i error:
unable load requested file: home.php
controller: home.php:
public function index(){ $this->load->view('home'); }
.htaccess:
rewriteengine on rewritecond $1 !^(index\\.php|resources|robots\\.txt) rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l,qsa]
on codeigniter 3 + versions couple of checks if getting errors below.
- error 404 page not found
- unable load requested file
check first.
- make sure file name has first letter upper case only
- make sure class name has first letter upper case only
- this applies models well.
warning: times though lower case may work on localhost other operating systems may cause error when file or class lower case, may not same everyone.
file name: home.php
<?php class home extends ci_controller { public function __construct() { parent::__construct(); $this->load->model('model_example'); } public function index(){ // $data['results'] = $this->model_example->get_results(); $this->load->view('home'); } }
folder structure view
application application > views > home.php
file name: model_example.php
<?php class model_example extends ci_model { public function get_results() { // code here. } }
on config.php
$config['base_url'] = 'http://localhost/your_project_name/';
Comments
Post a Comment