5

Is there any way to get Craft 3 to display 404.html and 503.html for the 404 and 503 pages while in devMode, as it did in Craft 2, rather than returning the entire Yii 2 error stack?

Sometimes, we have to bring a site temporarily offline (by way of toggle in the general settings tab) to add features, and we have to put it into dev mode for debug. We want the site to show the branded 503 page to the public instead of the stack page.

5
  • I'm confused... taking the site offline doesn't enable devMode?
    – Brad Bell
    Commented Jan 23, 2018 at 0:28
  • Is that a thing? 0___0; Is this a new feature or has this always been the way it's been?
    – Dustin C
    Commented Jan 23, 2018 at 1:07
  • 1
    I think he's saying that they take the site offline and sometimes enable devMode during that time to help them debug things. Commented Jan 23, 2018 at 13:02
  • 2
    @andrew.welch - Exactly! Does disabling a site through the control panel enable dev mode, though? If so - I never knew that was a feature, as it's not talked about very much. (That would be cool! And helpful.)
    – Dustin C
    Commented Jan 23, 2018 at 18:02
  • Same here, I didn't know that was a feature until just now :-)
    – Jan
    Commented Jul 9, 2018 at 7:40

2 Answers 2

3

Just posting this here since I saw an official answer in Github:

This changed in Beta 7:

UserException reports are now styled like other exceptions when Dev Mode is enabled, with the full stack trace shown.

You can see your 404 template by requesting it directly, e.g. http://mysite.dev/404

https://github.com/craftcms/cms/issues/1613#issuecomment-293366095

0

Another option is to check the response code directly in your config/general.php file.

'devMode' => http_response_code() == 200,

I suspect this "solution" will make peoples toes curl; as it's a bit hacky and probably won't work in all cases. So I'd recommend using this only in your dev environments.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.