Answer the question
In order to leave comments, you need to log in
RedirectResponse in EventSubscriber?
An event occurs, I do checks, if there is no access or the condition is not met, I try to make a redirect
public static function getSubscribedEvents() : array
{
return [
KernelEvents::EXCEPTION => [
['customMethodName', 0],
],
];
}
....
public fucntion customMethodName(...)
{
return new RedirectResponse('/');
header('Location: https://site.loc/);
exit;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question