title: Codeigniter: Controller routes the default controller Always
body: <p>I have this login page as the default controller in the routes page.When users logs in the system they should select the view they want.</p>
  
  <p><strong><em>login Home Page</em></strong></p>
  
  <pre><code>&lt;div class="form-group"&gt;
      &lt;select class="form-control" name="system" required&gt;
         &lt;option value=""&gt;--SYSTEM SELECT--&lt;/option&gt;
         &lt;option value="malaria"&gt;Malaria&lt;/option&gt;
         &lt;option value="familiy"&gt;Familiy Planning&lt;/option&gt;
         &lt;option value="lab"&gt;Laboratory&lt;/option&gt;
      &lt;/select&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><strong><em>Login Controller</em></strong></p>
  
  <pre><code>if($system=="malaria") {
              //redirect to malaria controller
              redirect(base_url().malaria);
        }else if($system=="familiy"){ 
              //redirect t family planning controller     
              redirect(base_url().family);
        }
        else if($system == 'lab'){
              redirect(base_url().lab);
        }else{
             redirect(base_url());
        }
  
        function logout(){
          $this-&gt;session-&gt;sess_destroy();
          redirect(base_url());
        }
  </code></pre>
  
  <p>Each of the controllers in the login controller works perfectly.
  when you load the page for the first time it selects the controllers, but when the user logs out the system doesn't select the system anymore, it loads the default controller</p>
  
  <p><strong><em>config.php</em></strong></p>
  
  <pre><code> $config['base_url'] = 'http://localhost/trial/';
   $config['index_page'] = '';
  </code></pre>
  
  <p><strong><em>routes.php</em></strong></p>
  
  <pre><code>    $route['default_controller'] = "login";
  </code></pre>
  
  <p><strong><em>.htaccess</em></strong></p>
  
  <pre><code>RewriteEngine On
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]
  </code></pre>
  
  <p>So when the user logs out the system should take them to the <code>base_url</code>.
  Which is the login page. The error is when the user logs out and wants to log in and selects the same view or any other view the system still loads the <code>base_url()</code>.</p>