...
CodeIgniter, Tutorials

Remove index.php from urls in Codeigiter

05 February 2019

In this blog, we will learn that how can we remove index.php from url in codeigniter. follow below instructions for removing index.php from url in codeigniter.

.htaccess file in root directory

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]

.htaccess file in application folder

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond $1 !^(index\.php|images|robots\.txt)
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

In application/config/config.php

search for

$config['index_page']='index.php';

and replace it with

$config['index_page']='';

Now we will get URLs without index.php

Leave a Comments