Removing index.php from URLs in CodeIgniter using htaccess

Removing index.php from URLs in CodeIgniter using htaccess

This post help you to remove index.php file form url using htaccess in codeigniter or ci

.htaccess file in root directory

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

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

In the 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

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

To

$config['index_page']='';

Now from your application url index.ph is removed.

Share Button

About admin

Leave a Reply

Your email address will not be published. Required fields are marked *

*

Author: pramod kumar kumawat Mob: 9269727062
Free WordPress Themes - Download High-quality Templates