redirect 404 /page/ to /page if /page.html exists

This commit is contained in:
Daniel Micay 2021-05-14 12:52:29 -04:00
parent 372046813f
commit 7a7648e6de

View File

@ -283,11 +283,21 @@ http {
internal;
}
location ~ "(\.html|/)$" {
location ~ "/$" {
include snippets/security-headers.conf;
add_header Cross-Origin-Resource-Policy "same-origin" always;
add_header Cache-Control "public, no-cache";
include snippets/preload.conf;
try_files ${uri}index.html @noslash;
}
# redirect /path/ to /path if /path.html exists
location @noslash {
rewrite ^(.*)/$ $1;
if (-f $request_filename.html) {
rewrite ^(.*) $1 permanent;
}
return 404;
}
location = /install/web {