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:

Example.php
redirect('login');

After the above code is executed, we will be redirected to http://my-domain.com/index.php/login.

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.php
$config['index_page'] = '';

0 0 vote
Article Rating
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x