0

this

echo anchor('perkalian','Perkalian');

is supposed to take me to:

http://localhost/codeigniter/index.php/hitung/perkalian

but instead, it takes me to:

http://localhost/codeigniter/index.php/localhost/CodeIgniter/index.php/perkalian

what is wrong with my code?

routing : $route['default_controller'] = 'hitung';

Sparky
  • 98,165
  • 25
  • 199
  • 285
Herdi
  • 1
  • 3

1 Answers1

0

Try adding a forward slash before URL in anchor like this:

echo anchor('/hitung/perkalian', 'Perkalian');

Or you can use site_url() method also:

echo anchor(site_url('/hitung/perkalian'), 'Perkalian');

Hope it will help.

d.coder
  • 1,988
  • 16
  • 23
  • Then may be you can try removing index.php from URL which you can find on CI documentations. [More on it](http://stackoverflow.com/questions/19183311/codeigniter-removing-index-php-from-url) – d.coder Dec 29 '16 at 12:12
  • What is the output of `echo site_url ();`? – d.coder Dec 29 '16 at 12:45
  • localhost/CodeIgniter/index.php/hitung/perkalian – Herdi Dec 29 '16 at 12:58