Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Static Caching - Update rewrite rules #1452

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions content/collections/docs/static-caching.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,29 @@ location @static {
:::


:::tip
If your site needs to support URLs with a trailing slash, make sure to update the NGINX config:

``` nginx
location / {
try_files $uri $try_location; # [tl! remove]
try_files $uri $uri/ $try_location; # [tl! add]
}

location @static {
try_files /static${uri}_$args.html $uri $uri/ /index.php?$args; # [tl! remove]
rewrite ^/(.*)/$ /$1 last; # [tl! add]
try_files /static${uri}_$args.html /static${uri}/_$args.html $uri $uri/ /index.php?$args; # [tl! add]
}

location @not_static {
try_files $uri /index.php?$args; # [tl! remove]
try_files $uri $uri/ /index.php?$args; # [tl! add]
}
```
:::


### IIS

On Windows IIS servers, your rewrite rules can be placed in a `web.config` file.
Expand Down