getAttributes(); $pathInfo = $request->getPathInfo(); if (str_contains($pathInfo, "/admin")) { return new RedirectResponse($this->urlGenerator->generate("app_home")); } if (in_array('application/json', $request->getAcceptableContentTypes())) { return new JsonResponse(null, Response::HTTP_FORBIDDEN); } return new JsonResponse(null, Response::HTTP_FORBIDDEN); } }