How can i avoid index.php from URL in codelgniter [closed]

Open config.php and replace

$config['index_page'] = "index.php" by $config['index_page'] = ""

In .htaccess file add

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

In some cases the default setting for uri_protocol does not work properly. To solve this problem just replace in config.php

$config['uri_protocol'] = "AUTO" by $config['uri_protocol'] = "REQUEST_URI"

Leave a Comment