Reputation: 103
<li><a href="<?php echo site_url('home'); ?>">Home</a></li>
that give to me localhost/farmex/localhost/farmex/home
and suppose to be localhost/farmex/home
Upvotes: 1
Views: 1205
Reputation: 7134
base_url
need to set to get proper link from site_url
function.
At your application/config.php you need to set
$config['base_url'] = 'http:/localhost/farmex/';
$config['index_page'] = '';
Remember $config['index_page']
is also important.
If you set
$config['index_page'] = 'index.php';
site_url('home')
will produce http:/localhost/farmex/index.php/home
$config['index_page'] = 'index.php?';
will produce http:/localhost/farmex/index.php?/home
which is needed sometimes.like if you don't want to use .htaccess file.
Upvotes: 0
Reputation: 247
in routes.php you can set $route['default_controller'] = 'home';
and change your code to
<li><a href="<?php echo base_url(); ?>">Home</a></li>
Hope this help! ^^
Upvotes: 1