base_url()
will echo:
http://localhost/project
where as site_url()
will echo:
http://localhost/project/index.php
You want to get to http://localhost/project/index.php/aboutus
but with base_url()
you're only getting to http://localhost/project/aboutus
which is giving you the error.
You can do two things,
this:
<a href="<?php echo base_url('index.php/aboutus'); ?>">AboutUs</a>
which means adding the index.php
before aboutus
or this:
<a href="<?php echo site_url('aboutus'); ?>">AboutUs</a>
which means changing base_url()
to site_url()
.
Make sure that you are loading the helper in the controller:
$this->load->helper(url);
Or in application/config/autoload.php
go to the line which says:
$autoload['helper'] = array();
and do this:
$autoload['helper'] = array('url');
and it will be included in every controller you now have.
If you have short tags enabled you can write your a
tag like this:
<a href="<?=site_url('aboutus');?>">About Us</a>
or if you have the url
helper you can write it like this:
echo anchor('aboutus', 'About Us', 'title="About Us"');