<p>That solution is viable. You can just test to see if the entry or the template matches your 404 template/entry. If you routed everything correctly to display a 404 in case of error, you should be fine.</p>

CC BY-SA 3.0
2015-07-02T19:39:43.903Z
2015-07-02T19:39:43.903Z
unsider
<p>In my 404 template I am extending a layout template. Inside that layout template I want to hide a section use an <code>{% if craft.request... == 404 %}</code> test. Any ideas on how I can accomplish this?</p>

CC BY-SA 3.0
2015-07-02T19:24:21.687Z
I found a solution after I posted this... this seems to work but I am not sure if it is accurate.

`{% if not entry %}`
Taylor
<404-page><404>
How can I test if a request returns a 404?
# How can I test if a request returns a 404?

(Asked by: username_0 on 2015-07-02)

In my 404 template I am extending a layout template. Inside that layout template I want to hide a section use an `{% if craft.request... == 404 %}` test. Any ideas on how I can accomplish this?

**Tags:** 404-page, 404

> **Comments:**
> **username_0**: I found a solution after I posted this... this seems to work but I am not sure if it is accurate.  `{% if not entry %}`  

---

## 1 answers

### Answer by username_1 on 2015-07-02. Score: 1 | Accepted answer

That solution is viable. You can just test to see if the entry or the template matches your 404 template/entry. If you routed everything correctly to display a 404 in case of error, you should be fine.


---

