I'm doing a project with CodeIgniter. When a user visits my page, I wish that by entering the address (in this case I am testing it on the localhost) of the site, access the home.php page.
I understand that to achieve this, the path $route['default_controller']
has to point to some controller where renderize the view I need.
Well, there is my problem. It does not happen. My route looks like this:
$route['default_controller'] = 'pages/index';
My controller looks like this:
<?php
class Pages extends CI_Controller{
public function index()
{
$this->load->view('frontend/templates/header');
$this->load->view('pages/home');
$this->load->view('frontend/templates/footer');
}
}
And of course I have the corresponding views in views/pages/home.php
and views/frontend/templates/header.php
and footer.php
.
Modify the .htaccess of the root folder a bit so that it looks like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
But when I go to the root route of my project, I just get a blank page. All other routes and functionalities work perfectly. Does anyone have an idea?