2

Whenever I hit a non-existent page on a dev site, I only get Craft's native 404 page, not the one I have at /craft/templates/404.html. The site has no routes. Any ideas why this might be?

3

It's quite possible that you are in Dev mode. If you switch to false, the 404.html may then be recognized…

Look at general.php, then change devMode to false.

// Dev environment settings 'dev' => [ 'devMode' => true, ],

| improve this answer | |
  • I certainly am in dev mode; I'm puzzled as to why custom 404 templates would be bypassed in dev mode though. Changing it to false doesn't make a difference. – Sandwich Dec 11 '17 at 16:56
  • Suggestion: you can drop in your html structure into the 404 template and add {% extends "_layouts/default.html" %}. – TRIM Dec 11 '17 at 21:25
  • 1
    Sorry, I don't see how that helps when the entire point of this question is that the 404 template isn't getting loaded in the first place. – Sandwich Dec 12 '17 at 11:14
  • 1
    This makes no sense. Why do we have to turn dev mode off to see the 404? – Dan Zuzevich Aug 24 '18 at 9:28
2

Turns out the general.php file had the following line (docs) in it:

'errorTemplatePrefix' => "_errors/"

Once I'd created the proper folder and files, all worked as expected.

Thanks, @CraftCMS Twitter person!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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