modX.sendUnauthorizedPage
Last updated Oct 14th, 2026 | Page history | Improve this page | Report an issue
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
Budget
$186 per month—let's make that $500!
Learn moremodX::sendUnauthorizedPage¶
Send the user to the MODX unauthorized page.
Syntax¶
void sendUnauthorizedPage ([array $options = null])
Before forwarding, the OnPageUnauthorized event is invoked with $options. The user is then sent to the resource configured in the unauthorized_page setting, falling back to site_start if that is not set.
$options may override the defaults filled from the unauthorized_page_header, unauthorized_page_pagetitle and unauthorized_page_message settings:
response_code,error_header— HTTP header line (default401 Unauthorized)error_type— error type passed on tosendError, default401error_pagetitle— defaultError 401: Unauthorizederror_message— default<h1>Unauthorized</h1><p>You are not authorized to view the requested content.</p>unauthorized_page— resource id of the unauthorized page for this call only
Example¶
Send the user to the unauthorized page. You do not need to terminate the script after running this.
$modx->sendUnauthorizedPage();
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
Budget
$186 per month—let's make that $500!
Learn more










