We solved this issue installing and configuring the HTTPS and WWW Redirect module
https://www.drupal.org/project/httpswww →
In addition to solving the index.php problem, it also redirects www and http which allows you to always have one session open and not several for registered users.