# 404 (Not Found)

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.

::tabs

::tab antlers
```antlers
{{ if ! logged_in }}
  {{ 404 }}
{{ /if }}

{{ if ! success }}
  {{ 404 }}
{{ /if }}
```

::tab blade
```blade
@if (! $logged_in }}
  <statamic:not_found />
@endif

@if (! $success)
  <statamic:not_found />
@endif
```

:::tip
If you want to trigger Statamic's 404 logic manually, you can throw an instance of the `NotFound` exception:

```php
<?php

use Statamic\Exceptions\NotFoundHttpException;

// Trigger Statamic's 404 logic.
throw new NotFoundHttpException();
```
:::
::

If you'd rather perform a _redirect_ instead of throwing a 404, you can use the [redirect tag](/tags/redirect.md).

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

