failed to work with base_url in Codeigniter 2.2.6

Asked

Viewed 604 times

1

I am trying to load bootstrap files into Codeigniter using base_url().
My autoload.php file has the following configuration
$autoload['helper'] = array('url');
In my view I put inside the head the following code.

 <link rel="stylesheet" href='<?= base_url("css/bootstrap.css"); ?>'>   

And in my Controller I put the following call:

$this->load->helper('url');
  • Any error appears? saw the source code of the page as the link is generated?

  • The page is looking like it’s not loading css. I copied the css, js and font folders to my project root and when displaying the source code the url is looking like this: <link rel="stylesheet" href="localhost:8084/ci/css/bootstrap.min.css">

  • base_url() .'css/bootstrap.css' if tantar like this has the same result? ci is the name of the project?

  • That, @rray. CI is the name of the project and the result was the same.

  • 1

    In the config folder, change the config.php file on that line to: $config['base_url'] = '/ci/'; That should eliminate the localhost:8084 of the url.

  • I already put together an answer.

Show 1 more comment

1 answer

1


You can configure the project url by setting a value for $config['base_url'] this variable is in the config.php file in the config folder.

$config['base_url'] = '/ci/'; 

Browser other questions tagged

You are not signed in. Login or sign up in order to post.