codeigniter PHP Web Development

How to remove index.php from codeigniter URL?

To remove index.php from codeigniter URL, openĀ application/config/config.php

1. Search for

$config[‘index_page’] = ‘index.php’;

and replace with

$config[‘index_page’] = ”;

 

2. Search for

$config[‘uri_protocol’] = ‘AUTO’;

and replace with

$config[‘uri_protocol’] = ‘REQUEST_URI’;

 

3. Add the below code to your .htaccess file on root of your web host directory:

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

Leave a Reply

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


CAPTCHA Image
Reload Image