docs: Adjustments for v2.4.6

This commit is contained in:
Francis Lavoie 2021-11-08 20:39:44 -05:00
parent f3f21afac0
commit e253d8efc9
No known key found for this signature in database
GPG key ID: 29B92EA7430C3C62
6 changed files with 57 additions and 9 deletions

View file

@ -13,7 +13,7 @@ Rewrites the request URI path to the first of the listed files which exists in t
try_files <files...>
```
- **<files...>** is the list of files to try. The URI will be rewritten to the first one that exists. To match directories, append a trailing forward slash `/` to the path. All file paths are relative to the site [root](/docs/caddyfile/directives/root). Each argument may also contain a query string, in which case the query string will also be changed if it matches that particular file.
- **<files...>** is the list of files to try. The URI will be rewritten to the first one that exists. To match directories, append a trailing forward slash `/` to the path. All file paths are relative to the site [root](/docs/caddyfile/directives/root). Each argument may also contain a query string, in which case the query string will also be changed if it matches that particular file. The last item in the list may be a number prefixed by `=` (e.g. `=404`), which as a fallback, will emit an error with that code; the error can be caught and handled with [`handle_errors`](/docs/caddyfile/directives/handle_errors).
## Expanded form
@ -49,3 +49,9 @@ Same, but also match directories:
```caddy-d
try_files {path} {path}/ /index.php?{query}&p={path}
```
Attempt to rewrite to a file or directory if it exists, otherwise emit a 404 error (which can be caught and handled with [`handle_errors`](/docs/caddyfile/directives/handle_errors)):
```caddy-d
try_files {path} {path}/ =404
```