Remove index.php From CodeIgniter URL Redirect

When we use the redirect helper function to redirect to a url, CodeIgniter will add index.php to this url in default. For example:


After the above code is executed, we will be redirected to

To remove index.php from URL redirect, we simply remove index.php value of $config['index_page'] configuration in the application/config/config.php file:

$config['index_page'] = '';