Cannot remove index.php from CodeIgniter URL

Please try the following

At first, make sure you set the config file like the following..

$config['index_page'] = '';

Also make sure that mod_rewrite is enabled in the httpd.conf file and after that, overwrite your .htaccess file which is located your project root folder not in the application folder with the following code..

RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1

Make sure in your application/config/config.php file this is set as follows:

$config['index_page'] = '';

Also do this:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond $1 !^CI/(index\.php|public|images|robots\.txt|css)
    RewriteRule ^CI/(.*)$ CI/index.php/$1 [L]
</IfModule>

Typically you don't put CI in its own directory and put application and system in the root folder.


Check your Apache configuration so that it is allowing an override. If the AllowOverride is set to None, the rewrite won't work for you.

Adding the following to your httpd.conf (NOT your .htaccess) should fix your problem

<Directory "/">
    AllowOverride All
</Directory>

Let me know if it's still not working.