core-bundle/src/Resources/contao/pages/PageError404.php
public function generate()
	{
		/** @var PageModel $objPage */
		global $objPage;

		$obj404 = $this->prepare();
		$objPage = $obj404->loadDetails();

		/** @var PageRegular $objHandler */
		$objHandler = new $GLOBALS['TL_PTY']['regular']();

		header('HTTP/1.1 404 Not Found');
		$objHandler->generate($objPage);
	}
public function generate()
	{
		/** @var PageModel $objPage */
		global $objPage;

		$obj404 = $this->prepare();
		$objPage = $obj404->loadDetails();

		/** @var PageRegular $objHandler */
		$objHandler = new $GLOBALS['TL_PTY']['regular']();

		header('HTTP/1.1 404 Not Found');
		$objHandler->generate($objPage);
	}
Generate an error 404 page