Base URL of destination link does not include subdirectories.

Created on 8 July 2023, over 1 year ago
Updated 10 July 2023, over 1 year ago

Problem/Motivation

We're currently using $this->requestStack->getCurrentRequest()->getSchemeAndHttpHost() to get the base url of the site. This returns the incorrect base URL when there is a subdirectory (or when using a language).

Steps to reproduce

  1. Create a Drupal website in a subdirectory.
  2. Try sending out an email.

Proposed resolution

Use \Drupal::urlGenerator()->generateFromRoute('<front>', [], ['absolute' => TRUE]) instead.

🐛 Bug report
Status

Fixed

Version

2.0

Component

Code

Created by

🇨🇦Canada Nathan Tsai

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024