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

<p>Look at general.php, then change <code>devMode</code> to <code>false</code>.</p>

<p><code>// Dev environment settings
    'dev' =&gt; [
        'devMode' =&gt; true,
    ],
</code> </p>

CC BY-SA 3.0
2017-12-11T16:56:39.257Z
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
CC BY-SA 3.0
2017-12-11T21:25:17.690Z
Suggestion: you can drop in your html structure into the 404 template and add `{% extends "_layouts/default.html" %}`.
TRIM
CC BY-SA 3.0
2017-12-12T11:14:28.790Z
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
CC BY-SA 4.0
2018-08-24T09:28:45.437Z
This makes no sense. Why do we have to turn dev mode off to see the 404?
Dan Zuzevich
CC BY-SA 3.0
2017-12-11T16:33:38.580Z
2017-12-11T16:33:38.580Z
TRIM
<ol>
<li>Make sure you are in production mode in the <strong>.env</strong> file: <code>ENVIRONMENT=production</code></li>
<li>Make sure you have developer mode disabled in <strong>config/general.php</strong> file: <code>'devMode'=&gt;false</code></li>
<li>Make sure you have a <strong>404.twig</strong> file in <strong>templates/</strong></li>
<li>This is not necessary, but ff you have all of the above and it still does not work, you can try adding this line in the <strong>config/general.php</strong> file: <a href="https://craftcms.com/docs/3.x/config/config-settings.html#errortemplateprefix" rel="nofollow noreferrer"><code>'errorTemplatePrefix' =&gt; &quot;404.twig&quot;</code></a></li>
</ol>
<p>You can also always go directly to the template and see if it is working. <code>http://yourpath.test/404</code></p>

CC BY-SA 4.0
2021-03-11T22:50:12.477Z
2021-03-11T23:48:19.423Z
2021-03-11T23:48:19.423Z
Alexis Dalai Waldo Jiménez
<p>Turns out the <code>general.php</code> file had the following line (<a href="https://craftcms.com/docs/config-settings#errorTemplatePrefix" rel="noreferrer">docs</a>) in it:</p>

<pre><code>'errorTemplatePrefix' =&gt; "_errors/"
</code></pre>

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

<p>Thanks, <a href="https://twitter.com/CraftCMS/status/967144907541397504" rel="noreferrer">@CraftCMS Twitter person</a>!</p>

CC BY-SA 3.0
2018-02-23T21:22:53.713Z
2018-02-23T21:22:53.713Z
Sandwich
<p>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 <code>/craft/templates/404.html</code>. The site has no routes. Any ideas why this might be?</p>

<templating><404><404-page>
Craft not loading custom 404 template for errors
# Craft not loading custom 404 template for errors

(Asked by: username_0 on 2017-12-11)

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?

**Tags:** templating, 404, 404-page

---

## 3 answers

### Answer by username_0 on 2018-02-23. Score: 6 | Accepted answer

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!


---

### Answer by username_1 on 2017-12-11. Score: 5

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,
],`

> **Comments:**
> **username_0**: 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.  
> **username_1**: Suggestion: you can drop in your html structure into the 404 template and add `{% extends "_layouts/default.html" %}`.  
> **username_0**: 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.  
> **username_2**: This makes no sense. Why do we have to turn dev mode off to see the 404?  

---

### Answer by username_3 on 2021-03-11. Score: 2

1. Make sure you are in production mode in the **.env** file: `ENVIRONMENT=production`
2. Make sure you have developer mode disabled in **config/general.php** file: `'devMode'=>false`
3. Make sure you have a **404.twig** file in **templates/**
4. This is not necessary, but ff you have all of the above and it still does not work, you can try adding this line in the **config/general.php** file: [`'errorTemplatePrefix' => "404.twig"`](https://craftcms.com/docs/3.x/config/config-settings.html#errortemplateprefix)

You can also always go directly to the template and see if it is working. `http://yourpath.test/404`


---

