Skip to content

Commit 05d986e

Browse files
davidbieliktimdorr
andauthored
404 route to file routing doc (#13769)
Co-authored-by: Tim Dorr <[email protected]>
1 parent 5db56e3 commit 05d986e

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/how-to/file-route-conventions.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,17 @@ export async function serverLoader({ params }) {
291291
}
292292
```
293293

294+
## Catch-all Route
295+
296+
To create a route that will match any requests that don't match other defined routes (such as a 404 page), create a file named `$.tsx` within your routes directory:
297+
298+
| URL | Matched Route |
299+
| -------------------------------------------- | ------------------------ |
300+
| `/` | `app/routes/_index.tsx` |
301+
| `/about` | `app/routes/about.tsx` |
302+
| `/any-invalid-path-will-match` | `app/routes/$.tsx` |
303+
304+
294305
## Escaping Special Characters
295306

296307
If you want one of the special characters used for these route conventions to actually be a part of the URL, you can escape the conventions with `[]` characters. This can be especially helpful for [resource routes][resource_routes] that include an extension in the URL.

0 commit comments

Comments
 (0)