Skip to content

Instantly share code, notes, and snippets.

@Da-Fecto
Created August 24, 2015 17:48
Show Gist options
  • Save Da-Fecto/bdb42507536011cf5294 to your computer and use it in GitHub Desktop.
Save Da-Fecto/bdb42507536011cf5294 to your computer and use it in GitHub Desktop.
// Stolen code, thanks Soma !
public function init() {
$this->addHookAfter("ProcessPageView::pageNotFound", $this, "hook404Page");
}
public function hook404Page($event){
header("HTTP/1.1 404 Page Not Found");
$page = wire("pages")->get("/404/"); // get your 404 page
$this->wire('page', $page);
$event->return = $page->render(); // render and return that page
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment