How can I remove index.php from URL in Codeigniter?

Member

by braeden , in category: Technology , 3 years ago

How can I remove index.php from URL in Codeigniter?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by kade.hermiston , 3 years ago

Follow below steps to index.php from URL in Codeigniter

  • Step 1: Open config.php and replaces
1
2
3
$config['index_page'] = "index.php" to $config['index_page'] = "" 
and
$config['uri_protocol'] ="AUTO" to $config['uri_protocol'] = "REQUEST_URI"
  • Step 2: Change your .htaccess file to
1
2
3
RewriteEngine on
RewriteCond $1 !^(index\.php|[Javascript / CSS / Image root Folder name(s)]|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]