CodeIgniter Forums
Best way to remove index.php and redirect to https - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: Best way to remove index.php and redirect to https (/showthread.php?tid=409)



Best way to remove index.php and redirect to https - aeoncube - 11-30-2014

Hey all,
I am trying to work out the best way to first remove the index.php from the URL and redirect to 'HTTPS' without causing 2 redirects. I prefer it to be done in a single redirect if possible. Any ideas would be great!
Thanks,


RE: Best way to remove index.php and redirect to https - trentramseyer - 12-02-2014

Remove the index.php, set the Index file in the config.php file to blank
Code:
/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = '';

To force https you can do that in the htaccess file (which you will also need to set correctly to use mod_rewrite above)

Which i would search for proper scenarios to match your needs on that


RE: Best way to remove index.php and redirect to https - sv3tli0 - 12-02-2014

It will be best if you have 2 redirect rules.

1st redirect to HTTPS all traffic - this will be common redirect as many clients don't enter https each time..
2nd remove index.php from the request - if you DON'T generate such url's with containing index.php there wont be many redirect regarding this case. So there is no point to mess it with the https rule.