Search code examples
phptwitter-bootstrapcodeigniter

Integrate Bootstrap on CodeIgniter


I'm trying to use bootstrap on a codeigniter web but it looks like the bootstrap files are not found

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="<?php echo base_url('application/bootstrap/css/bootstrap.min.css');?>" rel="stylesheet">
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="<?php echo base_url('application/bootstrap/js/bootstrap.min.js');?>"></script>

I've checked the paths generated by base_url() and it are correct.


Solution

  • move bootstrap folder on root location, because CI is understanding application folder as controller although application folder is restricted from client request by /application/.htaccess file

    |-
       |-application
       |-bootstrap
    
    //and use path as
    <?php echo base_url('bootstrap/css/bootstrap.min.css');?>