diff --git a/core/modules/language/lib/Drupal/language/HttpKernel/PathProcessorLanguage.php b/core/modules/language/lib/Drupal/language/HttpKernel/PathProcessorLanguage.php index 21bbbc80619b..2440d2f7b50d 100644 --- a/core/modules/language/lib/Drupal/language/HttpKernel/PathProcessorLanguage.php +++ b/core/modules/language/lib/Drupal/language/HttpKernel/PathProcessorLanguage.php @@ -155,6 +155,9 @@ class PathProcessorLanguage implements InboundPathProcessorInterface, OutboundPa $options['base_url'] = str_replace('https://', 'http://', $options['base_url']); } } + + // Add Drupal's subfolder from the base_path if there is one. + $options['base_url'] .= rtrim(base_path(), '/'); } } return $path; diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php index 8548f8eae664..c9c05e87d739 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php @@ -455,7 +455,7 @@ class LanguageUILanguageNegotiationTest extends WebTestBase { $this->rebuildContainer(); // Build the link we're going to test. - $link = 'it.example.com/admin'; + $link = 'it.example.com' . rtrim(base_path(), '/') . '/admin'; // Test URL in another language: http://it.example.com/admin. // Base path gives problems on the testbot, so $correct_link is hard-coded. diff --git a/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php index 07164841b3e2..780195927965 100644 --- a/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUrlRewritingTest.php @@ -134,7 +134,8 @@ class LanguageUrlRewritingTest extends WebTestBase { 'language' => $language, )); - $expected = $index_php ? 'http://example.fr:88/index.php/' : 'http://example.fr:88/'; + $expected = ($index_php ? 'http://example.fr:88/index.php' : 'http://example.fr:88') . rtrim(base_path(), '/') . '/'; + $this->assertEqual($url, $expected, 'The right port is used.'); // If we set the port explicitly in url(), it should not be overriden. @@ -144,7 +145,8 @@ class LanguageUrlRewritingTest extends WebTestBase { 'base_url' => $request->getBaseUrl() . ':90', )); - $expected = $index_php ? 'http://example.fr:90/index.php/' : 'http://example.fr:90/'; + $expected = $index_php ? 'http://example.fr:90/index.php' : 'http://example.fr:90' . rtrim(base_path(), '/') . '/'; + $this->assertEqual($url, $expected, 'A given port is not overriden.'); }