CodeIgniter Forums
Url Helper Function site_url() - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=11)
+--- Thread: Url Helper Function site_url() (/showthread.php?tid=69526)



Url Helper Function site_url() - Stef - 12-09-2017

Hey,

i have start now to learning this framework. I using in this time the url_helper with the function site_url().
I have in my config.php the base_url looking like this :  $config['base_url'] = 'localhost/htdocs/php/frameworks/codeigniter/';

Now if i using the site_url()-function the full url will be created, but if i pressing the link this base_url append to the other url in the url_bar in the browser. So my url is like this:  http://localhost/php/frameworks/codeigniter/index.php/news/localhost/htdocs/php/frameworks/codeigniter/news/

I have tried to delete the bas_url content. But if i do it, i get, if i pressed the url like this: [:019:]/php/frameworks/codeigniter/index.php/news

How i can solve this problem?


RE: Url Helper Function site_url() - dave friend - 12-09-2017

The value for $config['base_url'] should be a full URL including the protocol (i.e. http://). Try this

PHP Code:
$config['base_url'] = 'http://localhost/htdocs/php/frameworks/codeigniter/'



RE: Url Helper Function site_url() - Stef - 12-11-2017

Hey,

ok. Good to know it. This was the solution.

Thanks.