I have a Drupal 8 site and am encountering an issue. When I visit the site as an anonymous user and click a link on the menu, it adds /index.php to the url. Then if I navigate to that page and click another link in adds another index.php (i.e. example.com/index.php/index.php/link1/link2) and therefore the page will not load. This does not happen if I am logged into the site, has anyone encountered this before? I tried a fresh htaccess file and beyond that I am stumped. It is on a shared hosting plan. Any help is appreciated.
-
Possible duplicate of drupal.stackexchange.com/questions/200596/…– Mario SteinitzCommented Mar 13, 2018 at 2:18
-
Thank you, I did see that question, but there was not a definitive answer that I could find.– phandolinCommented Mar 13, 2018 at 17:27
-
Have you found a solution to the /index.php/index.php/ problem? I'm afraid this has something to do with Views…– nihilistenhymneCommented Jul 30, 2018 at 13:06
2 Answers
I had the same problem.
I have a view with links to content, where the URLs are item/[one content's field value]. One day, I watched the view as anonymous user and noticed that these had been changed to index.php/index.php/item/[one content's field value]. (On the other hand, when I visited as administrator user, it didn't happen.)
I didn't know why it happened, and it was solved by executing drush cc render
.
However, the problem would still be left.
The environment is Drupal 8.3.9 and PHP 7.0.25.
From here:
A solution. Install the Redirect Module, the default setting of Enforce clean and canonical URLs will fix the issue. However, there is also a long outstanding bug Route normalizer: Global Redirect in Drupal which apparently is the cause, but hasn't been pushed to Core yet.
-
Redirect fixed it for me (Drupal 9.3.6 Apache 2.4.29 PHP 7.4.28) after index.php was incorrectly inserted in links to uploaded files after many years of not being a problem. So I'd say there's quite likely a bug in core still?– iainHCommented Feb 20, 2022 at 12:02