title: How do I use codeigniter in a subfolder on a server?
body: <p>I have two codeigniter installations under my public_html folder on my  server. One is directly under public_html and the other is under public_html/posts_receive.</p>
  
  <p>The instance under public_html is working normal but when I try to access the codeigniter controller inside public_html/posts_receive it shows:</p>
  
  <blockquote>
    <p>404 Page Not Found </p>
    
    <p>tried url <a href="http://www.example.com/posts_receive/index.php/dashboard" rel="nofollow noreferrer">http://www.example.com/posts_receive/index.php/dashboard</a></p>
  </blockquote>
  
  <p>To solve this problem I have added an <code>.htaccess</code> file under public_html/posts_receive which contain the following:</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
      Options +FollowSymLinks
      RewriteEngine on
      RewriteBase /posts_receive
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?$1 [L]
  &lt;/IfModule&gt;
  </code></pre>
  
  <p>My controller is named <strong>dashboard.php</strong> and contains the following:</p>
  
  <pre><code>&lt;?php
  defined('BASEPATH') OR exit('No direct script access allowed');
  
  class Dashboard extends CI_Controller {
  
  
      public function __construct()
      {
          parent::__construct();
          $this-&gt;load-&gt;helper(array('form', 'url'));
  
          $this-&gt;load-&gt;library("pagination");
      }
  
      public function index() {
          $config = array();
  
          $data['link_sel']='dashboard';
          $data['stats']=$this-&gt;fetch_stats();
          $this-&gt;load-&gt;view("header_inc", $data);
          $this-&gt;load-&gt;view("dashboard", $data);
          $this-&gt;load-&gt;view("footer_inc", $data);
      }   
  }
  ?&gt;
  </code></pre>
  
  <p><strong>config.php</strong> includes:</p>
  
  <pre><code>$config['base_url'] = 'http://www.example.com/posts_receive/';
  $config['index_page'] = 'index.php';
  </code></pre>