Dipika Dipika - 27 days ago 11
PHP Question

How to set config_base url in config.php file in codeigniter?

I am beginner in codeigniter.
I have downloaded codeigniter and tried toconfigure it.How can i configure base url in codeigniter?

Answer

You should got to this file path

Codeigniter/applications/config/config.php

Search for this line that contains

$config['base_url'] = ""

Then your base_url should be

$config['base_url'] = "http://yoursite.com/"

If xampp, it should be

$config['base_url'] = "http://localhost/yoursite/"

And if wamp, it should be

$config['base_url'] = "http://www/yoursite/"

Note that yoursite is the filename of the site folder you have in htdocs or www folder

When you make use of <?php echo base_url(directory/file_name); ?> In your views, it should output something like:

 "http://localhost/yoursite.com/directory/file_name"

That should do the trick

Comments