I create a custom module in which if data is found the template is shown else I need to show default 404-page content & set the status to 404.
I have tried below code to set the status to 404 without changing the URL(i.e, not redirecting to noroute)
$resultPage->setStatusHeader(404, '1.1', 'Page Not Found'); $resultPage->setHeader('Status', '404 Page Not Found');
But I'm unable to show the default 404 error page content.
I have tried below code to forward the controller to default no route page, but it's not working for me.
Can anyone help me out from this? Thanks in advance.