lly modify the query parameters. $options = ['absolute' => TRUE]; $redirect_uri = $this->urlGenerator->generateFromRoute($route_name, [], $options); // Strip off query parameters added by the route such as a CSRF token. if (strpos($redirect_uri, '?') !== FALSE) { $redirect_uri = strtok($redirect_uri, '?'); } // Append back the request query string from $_SERVER. $query_string = $request->server->get('QUERY_STRING'); if ($query_string) { $redirect_uri .= '?' . $query_string; } // Remove /index.php from redirect uri the hard way. if (!RequestHelper::isCleanUrl($request)) { // This needs to be fixed differently. $redirect_uri = str_replace('/index.php', '', $redirect_uri); } $original_uri = $request->getSchemeAndHttpHost() . $request->getRequestUri(); $original_uri = urldecode($original_uri); if (urldecode($redirect_uri) != $original_uri) { $response = new TrustedRedirectResponse($redirect_uri, $this->config->get('default_status_code')); $response->headers->set('X-Drupal-Route-Normalizer', 1); $event->setResponse($response); } } } /** * {@inheritdoc} */ public static function getSubscribedEvents(): array { $events[KernelEvents::REQUEST][] = ['onKernelRequestRedirect', 30]; return $events; } } The website encountered an unexpected error. Try again later.

Error: Class "Drupal\redirect\EventSubscriber\RouteNormalizerRequestSubscriber" not found in Drupal\Component\DependencyInjection\Container->createService() (line 261 of core/lib/Drupal/Component/DependencyInjection/Container.php).