title: Object Not found in xampp server in code igniter?
body: <p>i am new to code igniter and i am developing simple login system for that i am using  xampp , i uploaded code igniter in folder code/ and the following are the codes in mvc </p>
  
  <p>controller  login.php</p>
  
  <pre><code> &lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
    class Login extends CI_Controller
       {
  
   public function __construct()
   {
        parent::__construct();
        $this-&gt;load-&gt;library('session');
        $this-&gt;load-&gt;helper('form');
        $this-&gt;load-&gt;helper('url');
        $this-&gt;load-&gt;helper('html');
        $this-&gt;load-&gt;database();
        $this-&gt;load-&gt;library('form_validation');
        //load the login model
        $this-&gt;load-&gt;model('login_model');
   }
  
   public function index()
   {
        //get the posted values
        $username = $this-&gt;input-&gt;post("txt_username");
        $password = $this-&gt;input-&gt;post("txt_password");
  
        //set validations
        $this-&gt;form_validation-&gt;set_rules("txt_username", "Username", "trim|required");
        $this-&gt;form_validation-&gt;set_rules("txt_password", "Password", "trim|required");
  
        if ($this-&gt;form_validation-&gt;run() == FALSE)
        {
             //validation fails
             $this-&gt;load-&gt;view('login_view');
        }
        else
        {
             //validation succeeds
             if ($this-&gt;input-&gt;post('btn_login') == "Login")
             {
                  //check if username and password is correct
                  $usr_result = $this-&gt;login_model-&gt;get_user($username, $password);
                  if ($usr_result &gt; 0) //active user record is present
                  {
                       //set the session variables
                       $sessiondata = array(
                            'username' =&gt; $username,
                            'loginuser' =&gt; TRUE
                       );
                       $this-&gt;session-&gt;set_userdata($sessiondata);
                       redirect("index");
                  }
                  else
                  {
                       $this-&gt;session-&gt;set_flashdata('msg', '&lt;div class="alert alert-danger text-center"&gt;Invalid username and password!&lt;/div&gt;');
                       redirect('login/index');
                  }
             }
             else
             {
                  redirect('login/index');
             }
        }
   }
   }?&gt;
  </code></pre>
  
  <p>MOdel is  login_model.php</p>
  
  <pre><code>&lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
   class login_model extends CI_Model
        {
     function __construct()
          {
        // Call the Model constructor
        parent::__construct();
           }
  
   //get the username &amp; password from tbl_usrs
     function get_user($usr, $pwd)
      {
          $sql = "select * from tbl_usrs where username = '" . $usr . "' and password = '" . md5($pwd) . "' and status = 'active'";
        $query = $this-&gt;db-&gt;query($sql);
        return $query-&gt;num_rows();
   }
    }?&gt;
  </code></pre>
  
  <p>And View is login_view</p>
  
  <pre><code>   &lt;!DOCTYPE html&gt;
     &lt;html&gt;
       &lt;head&gt;
   &lt;meta charset="utf-8"&gt;
   &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
   &lt;title&gt;Login Form&lt;/title&gt;
   &lt;!--link the bootstrap css file--&gt;
   &lt;link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet"&gt;
  
   &lt;style type="text/css"&gt;
   .colbox {
        margin-left: 0px;
        margin-right: 0px;
   }
   &lt;/style&gt;
     &lt;/head&gt;
             &lt;body&gt;
                &lt;div class="container"&gt;
                        &lt;div class="row"&gt;
                   &lt;div class="col-lg-6 col-sm-6"&gt;
             &lt;h1&gt;COLORS&lt;/h1&gt;
        &lt;/div&gt;
        &lt;div class="col-lg-6 col-sm-6"&gt;
  
             &lt;ul class="nav nav-pills pull-right" style="margin-top:20px"&gt;
                  &lt;li class="active"&gt;&lt;a href="#"&gt;Login&lt;/a&gt;&lt;/li&gt;
                  &lt;li&gt;&lt;a href="#"&gt;Signup&lt;/a&gt;&lt;/li&gt;
             &lt;/ul&gt;
  
             &lt;/div&gt;
            &lt;/div&gt;
         &lt;/div&gt;
          &lt;hr/&gt;
  
                &lt;div class="container"&gt;
                 &lt;div class="row"&gt;
        &lt;div class="col-lg-4 col-sm-4 well"&gt;
        &lt;?php 
        $attributes = array("class" =&gt; "form-horizontal", "id" =&gt; "loginform", "name" =&gt; "loginform");
        echo form_open("login/index", $attributes);?&gt;
        &lt;fieldset&gt;
             &lt;legend&gt;Login&lt;/legend&gt;
             &lt;div class="form-group"&gt;
             &lt;div class="row colbox"&gt;
             &lt;div class="col-lg-4 col-sm-4"&gt;
                  &lt;label for="txt_username" class="control-label"&gt;Username&lt;/label&gt;
             &lt;/div&gt;
             &lt;div class="col-lg-8 col-sm-8"&gt;
                  &lt;input class="form-control" id="txt_username" name="txt_username" placeholder="Username" type="text" value="&lt;?php echo set_value('txt_username'); ?&gt;" /&gt;
                  &lt;span class="text-danger"&gt;&lt;?php echo form_error('txt_username'); ?&gt;&lt;/span&gt;
             &lt;/div&gt;
             &lt;/div&gt;
             &lt;/div&gt;
  
             &lt;div class="form-group"&gt;
             &lt;div class="row colbox"&gt;
             &lt;div class="col-lg-4 col-sm-4"&gt;
             &lt;label for="txt_password" class="control-label"&gt;Password&lt;/label&gt;
             &lt;/div&gt;
             &lt;div class="col-lg-8 col-sm-8"&gt;
                  &lt;input class="form-control" id="txt_password" name="txt_password" placeholder="Password" type="password" value="&lt;?php echo set_value('txt_password'); ?&gt;" /&gt;
                  &lt;span class="text-danger"&gt;&lt;?php echo form_error('txt_password'); ?&gt;&lt;/span&gt;
             &lt;/div&gt;
             &lt;/div&gt;
             &lt;/div&gt;
  
             &lt;div class="form-group"&gt;
             &lt;div class="col-lg-12 col-sm-12 text-center"&gt;
                  &lt;input id="btn_login" name="btn_login" type="submit" class="btn btn-default" value="Login" /&gt;
                  &lt;input id="btn_cancel" name="btn_cancel" type="reset" class="btn btn-default" value="Cancel" /&gt;
             &lt;/div&gt;
             &lt;/div&gt;
        &lt;/fieldset&gt;
        &lt;?php echo form_close(); ?&gt;
        &lt;?php echo $this-&gt;session-&gt;flashdata('msg'); ?&gt;
                 &lt;/div&gt;
               &lt;/div&gt;
               &lt;/div&gt;
  
            &lt;!--load jQuery library--&gt;
         &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"&gt;&lt;/script&gt;
         &lt;!--load bootstrap.js--&gt;
       &lt;script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"&gt;&lt;/script&gt;
       &lt;/body&gt;
        &lt;/html&gt;
  </code></pre>
  
  <p>IN config i used
      $config['index_page'] = '';
  and in routes i used
      $route['default_controller'] = 'login';
      $route['404_override'] = '';
      $route['translate_uri_dashes'] = FALSE;
  while accessing localhost/code/ it is working fine but when click login button it is going to url  <a href="http://localhost/code/localhost/login/index" rel="noreferrer">http://localhost/code/localhost/login/index</a> and showing object not found  ERROR 404</p>