We’re rewarding the question askers & reputations are being recalculated! Read more.

New answers tagged

1

With the help from @4k4 I found a solution. I created an event subscriber that extends the HttpExceptionSubscriberBase class. There I created the redirect like this: public function on404(GetResponseForExceptionEvent $event) { $response = new TrustedRedirectResponse('https://google.com', 307); $event->setResponse($response); }


0

The correct way to set a redirection after a form is submitted, in Drupal 8, is following these steps. Implement hook_form_alter() or hook_form_FORM_ID_alter() to add a form submission handler to the form On the form submission handler, use FormState::setRedirect(), which require a route name, or FormState::setRedirectUrl(), which requires a \Drupal\Core\...


1

Routes are not only defined in yaml files, but also dynamically in route subscribers. Drupal\views\EventSubscriber\RouteSubscriber collects routes from all views displays which implement DisplayRouterInterface::collectRoutes, like the Page display: PathPluginBase::collectRoutes: public function collectRoutes(RouteCollection $collection) { $view_id = ...


0

Concerning CDNs or Varnish you need to ask in a different place. In Drupal you find two caches for requests/responses: The Internal Page Cache, which is implemented in a kernel middleware, and you need to define a middleware with a higher priority to handle the uncached request. The Dynamic Page Cache, which is implemented in a kernel request subscriber, ...


Top 50 recent answers are included