From 2d95094fbd3223616b5e69a218f0af84cf9164da Mon Sep 17 00:00:00 2001 From: Brendan Golden Date: Tue, 13 Aug 2024 00:09:32 +0100 Subject: [PATCH] feat: allow having nice links without .html --- applications/skynet.ie/wiki.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/applications/skynet.ie/wiki.nix b/applications/skynet.ie/wiki.nix index c5f106e..5e9530b 100644 --- a/applications/skynet.ie/wiki.nix +++ b/applications/skynet.ie/wiki.nix @@ -41,6 +41,15 @@ in { forceSSL = true; useACMEHost = "skynet"; root = "${inputs.skynet_website_renew.defaultPackage."x86_64-linux"}/wiki"; + # https://stackoverflow.com/a/38238001/11964934 + extraConfig = '' + location / { + if ($request_uri ~ ^/(.*)\.html) { + return 302 /$1; + } + try_files $uri $uri.html $uri/ =404; + } + ''; }; # redirect old links to the new wiki