Radical Design Course by Jack McDade

From the creator of Statamic

Learn how to make your websites standout and be remembered.

Bought Jack McDade's course on design. Going through it now...and it is SO well done!

— Justin Jackson, Transistor.fm

404 (Not Found) Tag

Anytime this tag is rendered — whether in a template, partial, or content, Statamic will trigger a 404 status code and render your 404 template.

Overview

The most common use cases for the 404 tag is for checking if a user is logged in or has performed an action before displaying a particular page.

{{ if ! logged_in }}
{{ 404 }}
{{ /if }}
 
{{ if ! success }}
{{ 404 }}
{{ /if }}

If you'd rather perform a redirect instead of throwing a 404, you can use the redirect tag.

Hot Tip!

There's no need to wrap the rest of the template in an else condition.

Docs feedback

Submit improvements, related content, or suggestions through Github.

Betterify this page →
Hello there! Are you looking for the Statamic v2 documentation?