title: Codeigniter URL rewrite to remove index.php
body: <p>First of all, i have tried the suggestion specified in here:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/24357271/codeigniter-removing-index-php-not-working">CodeIgniter removing index.php not working</a></li>
  <li><a href="https://stackoverflow.com/questions/20523033/codeignitor-remove-index-php-not-working">codeignitor: Remove index.php not working</a></li>
  <li><a href="https://stackoverflow.com/questions/28258126/codeigniter-htaccess-index-php-rewrite-not-working-on-user-directory">CodeIgniter .htaccess index.php rewrite not working on user directory</a></li>
  <li><a href="https://stackoverflow.com/questions/1445385/how-to-remove-index-php-in-codeigniters-path">How to remove &quot;index.php&quot; in codeigniter&#39;s path</a></li>
  <li><a href="https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html" rel="nofollow noreferrer">https://ellislab.com/expressionengine/user-guide/urls/remove_index.php.html</a></li>
  <li><a href="https://stackoverflow.com/questions/8259425/rewriterule-for-codeigniter-not-working">Rewriterule for CodeIgniter not working</a></li>
  </ul>
  
  <p>I am trying to remove the infamous <code>index.php</code> on the address bar. </p>
  
  <p>This is my current configuration:</p>
  
  <blockquote>
    <p>In my /etc/apache2/sites-available/my.website.com.conf file i put this:</p>
  </blockquote>
  
  <pre><code>&lt;Directory /path/to/root/directory/&gt;
     AllowOverride All
     Order allow,deny
     Allow from all
  &lt;/Directory&gt;
  </code></pre>
  
  <p>In my /etc/apache2/apache2.conf file, i put this:</p>
  
  <pre><code>&lt;Directory /path/to/root&gt;
          Options Indexes FollowSymLinks
          AllowOverride None
          Require all granted
  &lt;/Directory&gt;
  </code></pre>
  
  <blockquote>
    <p>In my codeigniter root directory (same dir with index.php), i have a .htaccess like this:</p>
  </blockquote>
  
  <pre><code>&lt;IfModule mod_rewrite&gt;
          RewriteEngine On
          RewriteBase /
  
          #Removes access to the system folder by users.
          #Additionally this will allow you to create a System.php controller,
          #previously this would not have been possible.
          #'system' can be replaced if you have renamed your system folder.
  
          RewriteCond %{REQUEST_URI} ^system.*
          RewriteRule ^(.*)$ /index.php?/$1 [L]
  
          #When your application folder isn't in the system folder
          #This snippet prevents user access to the application folder
          #Submitted by: Fabdrol
          #Rename 'application' to your applications folder name.
          RewriteCond %{REQUEST_URI} ^application.*
          RewriteRule ^(.*)$ /index.php?/$1 [L]
  
          #Checks to see if the user is attempting to access a valid file,
          #such as an image or css document, if this isn't true it sends the
          #request to index.php
  
          RewriteCond %{REQUEST_FILENAME} !-f
          RewriteCond %{REQUEST_FILENAME} !-d
          RewriteRule ^(.*)$ index.php?/$1 [L]
  &lt;/ifmodule&gt;
  
  &lt;IfModule !mod_rewrite.c&gt;
          # If we don't have mod_rewrite installed, all 404's
          # can be sent to index.php, and everything works as normal.
          # Submitted by: ElliotHaughin
  
          ErrorDocument 404 /index.php
  &lt;/ifmodule&gt;
  </code></pre>
  
  <blockquote>
    <p>And finally, my application/config/config.php:</p>
  </blockquote>
  
  <pre><code>$config['base_url'] = 'http://my.website.com';
  $config['index_page'] = '';
  $config['uri_protocol'] = 'REQUEST_URI';
  </code></pre>
  
  <p>When i tested the above config on my local PC (running Ubuntu 14.04) it works just fine. However when i try to replicate the config on my server (running Ubuntu 14.04), somehow it does not work.</p>
  
  <p><strong>Doing this:</strong></p>
  
  <ul>
  <li><a href="http://my.website.com/" rel="nofollow noreferrer">http://my.website.com/</a> &lt;&lt; Shows default Codeigniter welcome page</li>
  <li><p><a href="http://my.website.com/controller_name/" rel="nofollow noreferrer">http://my.website.com/controller_name/</a> &lt;&lt; Shows :</p>
  
  <p>Not Found
  The requested URL /login was not found on this server.
  Apache/2.4.7 (Ubuntu) Server at my.website.com Port 80</p></li>
  <li><p><a href="http://my.website.com/index.php/controller_name" rel="nofollow noreferrer">http://my.website.com/index.php/controller_name</a> &lt;&lt; shows the page, however URL to static files (i.e JS/CSS/images) are not properly fetched, since printing this:</p>
  
  <pre><code>  &lt;link rel="stylesheet" href="assets/styles/material-design-icons.css" type="text/css" /&gt;
    &lt;link rel="stylesheet" href="assets/styles/font.css" type="text/css" /&gt;
    &lt;link rel="stylesheet" href="assets/styles/app.css" type="text/css" /&gt;
  </code></pre></li>
  </ul>
  
  <p>would append <strong>index.php</strong> when seen from source code inspector.</p>
  
  <p>Am i missing something here? Can someone point me to the right direction? </p>
  
  <p>Thanks.</p>
  
  <p>EDIT #1
  Below is my folder structure</p>
  
  <p><a href="https://i.stack.imgur.com/KVLx3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KVLx3.png" alt="Dir Structure"></a></p>
  
  <p>EDIT #2
  I can confirm that mod_rewrite is enabled</p>
  
  <p><a href="https://i.stack.imgur.com/LebCK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LebCK.png" alt="PHP Info"></a></p>