I developed a project with CodeIgniter on windows XAMPP which works. But does not work on Linux-based remote server.
I get the error:
Unable to load the 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 a couple of checks to do if getting errors below.
Check first.
Warning: Some times even though lower case may work on some localhost some other operating systems it may cause error when file or class are lower case, it may not be the same for 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 for View
application
application > views > home.php
File name: Model_example.php
<?php
class Model_example extends CI_Model {
public function get_results() {
// Some Code Here.
}
}
On your config.php
$config['base_url'] = 'http://localhost/your_project_name/';
Rather than uploading the codeigniter site directly you should be able to use something like Putty (http://www.putty.org/) to install a fresh version of Codeigniter through script and then add the files for your site to the installation.
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
The script used to install a fresh version of CI will differ based on what Linux platform you're using. wget is used for ubuntu.