I have encountered an issue with page linking using codeigniter, when navigating from my Home screen to another screen called Live I am getting the the error below:
Object not found!
The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.
If you think this is a server error, please contact the webmaster.
Error 404
127.0.0.1 Apache/2.4.7 (Win32) PHP/5.4.24
The home screen link: http://127.0.0.1/projects/companyname/index.php/home
The link of the screen i'm trying to get to: http://127.0.0.1/projects/companyname/home/v_Live
home.php controller (bottom section):
class Home extends CI_Controller
{
public function __construct()
{
parent::__construct();
$this->load->helper('url');
$this->load->model('m_login');
}
public function index()
{
if($this->session->userdata('isLogin') == FALSE)
{
redirect('login/login_form');
}else
{
$this->load->model('m_login');
$user = $this->session->userdata('username');
$data['level'] = $this->session->userdata('level');
$data['user'] = $this->m_login->userData($user);
$this->load->view('home', $data);
}
--> function index ()
{
function home (){
$this->load->view("home");
$this->load->view("v_Live");
}
function Live (){
$this->load->view("home");
$this->load->view("v_Live"); <----
}
}
}
}
?>
home view:
<nav>
<ul>
<li><a href="home.php">Home</a></li>
<li>
<a href="Cloud_Clients.html">Cloud Clients<span class="caret"></span></a>
<div>
<ul>
<li><a href="<?php echo base_url(); ?>home/v_Live">Live</a></li>
<li><a href="PreProduction.html">Pre-Production</a></li>
<li><a href="Clients.html">Client Versions</a></li>
</ul>
</div>
</li>
<li><a href="about.html">About</a></li>
<li><a href="help.html">Help</a></li>
</ul>
</nav>
v_Live screen view:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Live</title>
</head>
<body>
<nav>
<ul>
<li><a href="home.php">Home</a></li>
<li>
<a href="Cloud_Clients.html">Cloud Clients<span class="caret"></span></a>
<div>
<ul>
<li><a href="<?php echo base_url(); ?>>home/v_Live">Live</a></li>
<li><a href="PreProduction.html">Pre-Production</a></li>
<li><a href="Clients.html">Client Versions</a></li>
</ul>
</div>
</li>
<li><a href="about.html">About</a></li>
<li><a href="help.html">Help</a></li>
</ul>
</nav>
<table>
<tr>
<th>ID</th>
<th>Client Name</th>
<th>App Server</th>
<th>Instance Name</th>
</tr>
<?php
foreach($records as $row):
?>
<tr>
<td><?=$row->id?></td>
<td><?=$row->Client Name?></td>
<td><?=$row->App Server?></td>
<td><?=$row->Instance Name?></td>
</tr>
<?php
endforeach;
?>
</table>
</body>
</html>
config file:
$config['base_url'] = 'http://127.0.0.1/projects/**companyname**/';
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = 'index.php';
hopefully this is enough information for help.
Thanks
If the version of your codeigniter is 3, then file name should start with capital letter.
Next, have you added .htaccess
file ?? if not access the url with index.php.
or use following code to remove the index.php from url.
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
add this file in root with name .htaccess
.This will help you in removing index.php
in url
And remove index.php
in $config
and make $config['index_page'] = "";
And also remove the base_url()
. Codeigniter is brave enough to identify it.