Reputation: 347
help me with this code.
<a href="<?php echo site_url('calculator/');?>"><< Kembali menghitung</a>
when i click the link it posted double like : http://localhost/belajarci/index.php/calculator/localhost/belajarci/index.php/calculator
ive tried to remove the href values but the page not refered to the home, its only change another value in my code.
Upvotes: 3
Views: 821
Reputation: 545
It's right it's redirecting on double url becasue of you need to include $this->load->helper('url')
in your file / controller constructor or use url helper in autoload.php
Also do two things in your configuration:
Upvotes: 1
Reputation: 16117
You are getting this URL:
http://localhost/belajarci/index.php/calculator/localhost/belajarci/index.php/calculator
Because you need to include $this->load->helper('url')
in your file / controller constructor or use url
helper in autoload.php
After loading url helper your URL will work as you need.
You can also follow the CI User Manual: https://codeigniter.com/userguide3/helpers/url_helper.html
Upvotes: 1