![]() |
base_url() question - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: base_url() question (/showthread.php?tid=43343) |
base_url() question - El Forum - 07-08-2011 [eluser]Krystian[/eluser] Hi, I`m using url helper. Lets say that all CI files are in app01 folder. when I Code: echo base_url() // return app01/ beacuse of $config['base_url'] = 'app01/'; but why when Code: <a href="<?php echo base_url(); ?>main/login">DASBOARD</a> it returns 127.0.0.1/app01/main/app01/main/login Krystian base_url() question - El Forum - 07-08-2011 [eluser]danmontgomery[/eluser] This is because of the way the <a> tag works. Your base_url is a relative path, so that's the url that base_url() creates. base_url in your configuration should be the full web path: Code: $config['base_url'] = 'http://127.0.0.1/app01/'; base_url() question - El Forum - 07-08-2011 [eluser]Irfan Cikoglu[/eluser] (w/ URL Helper) This more cooler :p Code: <?php echo anchor('main/login', 'DASHBOARD'); ?> ![]() |