Jump to main content Jump to doc navigation

modX::sendErrorPage

Send the user to a MODX virtual error page.

Syntax

void sendErrorPage ([array $options = null])

Before forwarding, the OnPageNotFound event is invoked with $options. The user is then sent to the resource configured in the error_page setting, falling back to site_start if that is not set.

$options may override the defaults filled from the error_page_header, error_page_pagetitle and error_page_message settings:

  • response_code, error_header — HTTP header line (default 404 Not Found)
  • error_type — error type passed on to sendError, default 404
  • error_pagetitle — default Error 404: Page not found
  • error_message — default <h1>Page not found</h1><p>The page you requested was not found.</p>
  • error_page — resource id of the error page for this call only

Example

Send the user to the default Error page for the site.

$modx->sendErrorPage();

See Also

Support the team building MODX with a monthly donation.

The budget raised through OpenCollective is transparent, including payouts, and any contributor can apply to be paid for their work on MODX.

Backers

  • modmore
  • STERC
  • Digital Penguin
  • Jens Wittmann – Gestaltung & Entwicklung
  • CrewMark
  • Fabian Christen
  • Sepia River Studios
  • Dannevang Digital
  • A. Moreno
  • Alex
  • Chris Fickling
  • Stéphane Jäggi
  • Murray Wood
  • Anton Tarasov
  • JT Skaggs
  • deJaya
  • Lefthandmedia
  • eydolan
  • Following Sea
  • Guido Gallenkamp
  • YJ
  • Raffy
  • Snow Creative
  • Nick Clark
  • Guest
  • Helen
  • krisznet
  • Yanni
  • Richard

Budget

$194 per month—let's make that $500!

Learn more