diff --git a/website-next/nginx/conf.d/redirects.conf b/website-next/nginx/conf.d/redirects.conf index 3a404af6c77..ec9a9e4b61e 100644 --- a/website-next/nginx/conf.d/redirects.conf +++ b/website-next/nginx/conf.d/redirects.conf @@ -8,6 +8,12 @@ # * use `rewrite ... redirect` for 302 redirects # * group related rules with a short comment +# Always strip trailing slashes. The static export uses non-slash URLs +# (`trailingSlash: false`), so any path with a trailing slash 404s. Running +# this first canonicalizes the path so every later rule and the file lookup +# operate on the slash-free form (the root `/` is left untouched). +rewrite ^/(.+)/$ /$1 permanent; + # temporary redirects rewrite ^/platform/bananacakepop/?$ /products/nitro redirect; rewrite ^/products/hotchocolate/?$ /docs/hotchocolate redirect;