0

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.

3

2 Answers 2

5

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.

1

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.

1
  • 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?
    – iainH
    Feb 20, 2022 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.