diff --git a/nginx.conf b/nginx.conf index f0f92c4..c1d60b2 100644 --- a/nginx.conf +++ b/nginx.conf @@ -35,12 +35,14 @@ http { # Rename cheatsheet rewrite ^/golang$ /go permanent; - # remove .html extension location / { - if ($request_uri ~ ^/(.*)\.html) { - return 302 /$1; - } - try_files $uri $uri.html $uri/ =404; + try_files $uri $uri/ @html; + } + + location @html { + # remove .html extension + rewrite ^(.*)\.html$ $1 permanent; + try_files $uri.html $uri/ =404; } } }