Welcome Guest, Not a member yet? Register   Sign In
base_url() question
#1

[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="&lt;?php echo base_url(); ?&gt;main/login">DASBOARD</a>

it returns 127.0.0.1/app01/main/app01/main/login

Krystian
#2

[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/';
#3

[eluser]Irfan Cikoglu[/eluser]
(w/ URL Helper)

This more cooler :p
Code:
&lt;?php echo anchor('main/login', 'DASHBOARD'); ?&gt;
Wink




Theme © iAndrew 2016 - Forum software by © MyBB