0

I've taken over on a project developed by another supplier and now tasked with resolving the issues. I don't know if this is a Drupal, PHP or Apache problem, but here goes.

It's a Drupal 8 multisite with 3 databases. There's a main site and two country sites.

It's installed in the webfolder (/) and contains a regular Drupal 8 setup. It also has two symbolic links (/nl and /de) that point to the same folder. The domains and sites are defined in sites.php.

The current issue is that a part of the path is repeated in the URL e.g. /nl/nl/nl/over-ons and I can't figure out why. It's a link placed in a menu. It makes no difference if the link is defined as a path or route.

It only does this for anonymous traffic (authenticated shows the right link) and it doesn't do this consistently. Sometimes the link is as it should be, other times it added the prefixes. Sometimes there are three prefixes, other times 4, 5 or 7 or whatever. To make it worse: I can't reproduce it locally.

Production environment is Apache/PHP 7.2.20 (Apache 2.0 Handler) Local environment is a Docker setup with PHP as FastCGI plugin.

Any pointers on what the cause is or how to debug?

  • Something that might be a factor - Drupal will inject the language code for a page into the URL so you can have multiple languages for the same content. So that might be part of the problem. The fact this is intermittent and only for anon traffic suggests that something in the request causes urls to be built wrong and then cached, so I'd also try setting language in the browser, or you may need to craft your anon requests in other ways to trigger the weirdness. – Alfred Armstrong Aug 5 '19 at 13:47
  • You have recursive symbolic links. If you then have configured the same prefixes in Drupal they are added to the path for outgoing links. If someone clicks on such a link or a search engine follows the links a prefix is added each time. – 4k4 Aug 5 '19 at 13:47
  • Drupal is configured that it has a default language (without a language prefix) for the /nl 'subfolder'. The language prefix for the other language is /nl-en. In some cases it includes the other symbolic link in the path (like /nl/nl/de/nl/nl/de/linkname). So it's the symbolic link that's the root cause of this, and Drupals inability to correctly resolve this. – Web-Beest Aug 6 '19 at 7:04
  • To resolve this you can try route normalizing, see drupal.org/project/drupal/issues/2641118. You can either use the patch or install the module Redirect. – 4k4 Aug 6 '19 at 21:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.