In a custom module i'm using an
EventSubscriber to redirect different people to different frontpages. Below is the simplified code I'm using.
//GET PATH $nid = 1; $domain_url = \Drupal::service('path_alias.manager')->getAliasByPath('/node/'. $nid); //FRONTPAGE REDIRECT $response = new RedirectResponse($domain_url); $event->setResponse($response);
The module is working but there is one detail I can't seem to solve.
For example on my website
domain.com I have
node/1 that has an alias path
When going to
domain.com it is, because of my module as expected, redirected to
domain.com/home. But what I want is the url not to show the
home part. Is it possible to show the content of
/home but keeping the url